restore 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
  8. source ../settings/scripts/_common.sh
  9. source /usr/share/yunohost/helpers
  10. #=================================================
  11. # RESTORE THE APP MAIN DIR
  12. #=================================================
  13. ynh_script_progression --message="Restoring the app main directory..." --weight=1
  14. ynh_restore_file --origin_path="$install_dir"
  15. chmod -R o-rwx "$install_dir"
  16. chown -R $app:www-data "$install_dir"
  17. #=================================================
  18. # SPECIFIC RESTORATION
  19. #=================================================
  20. # REINSTALL DEPENDENCIES
  21. #=================================================
  22. ynh_script_progression --message="Reinstalling dependencies..." --weight=1
  23. # Install Nodejs
  24. ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
  25. #=================================================
  26. # RESTORE THE NGINX CONFIGURATION
  27. #=================================================
  28. ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
  29. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
  30. ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
  31. systemctl enable $app.service --quiet
  32. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  33. #=================================================
  34. # START SYSTEMD SERVICE
  35. #=================================================
  36. ynh_script_progression --message="Starting a systemd service..." --weight=1
  37. ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
  38. ynh_systemd_action --service_name=nginx --action=reload
  39. #=================================================
  40. # END OF SCRIPT
  41. #=================================================
  42. ynh_script_progression --message="Restoration completed for $app" --last