restore 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
  3. source ../settings/scripts/_common.sh
  4. source /usr/share/yunohost/helpers
  5. #=================================================
  6. # RESTORE THE APP MAIN DIR
  7. #=================================================
  8. ynh_script_progression "Restoring the app main directory..."
  9. ynh_restore "$install_dir"
  10. #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
  11. #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
  12. #=================================================
  13. # SPECIFIC RESTORATION
  14. #=================================================
  15. # REINSTALL DEPENDENCIES
  16. #=================================================
  17. ynh_script_progression "Reinstalling dependencies..."
  18. # Install Nodejs
  19. ynh_nodejs_install
  20. #=================================================
  21. # RESTORE SYSTEM CONFIGURATIONS
  22. #=================================================
  23. ynh_script_progression "Restoring system configurations related to $app..."
  24. ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
  25. ynh_restore "/etc/systemd/system/$app.service"
  26. systemctl enable $app.service --quiet
  27. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  28. #=================================================
  29. # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
  30. #=================================================
  31. ynh_script_progression "Reloading NGINX web server and $app's service..."
  32. ynh_systemctl --service=$app --action="start" --log_path="systemd"
  33. ynh_systemctl --service=nginx --action=reload
  34. #=================================================
  35. # END OF SCRIPT
  36. #=================================================
  37. ynh_script_progression "Restoration completed for $app"