upgrade 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source _common.sh
  8. source /usr/share/yunohost/helpers
  9. #=================================================
  10. # CHECK VERSION
  11. #=================================================
  12. upgrade_type=$(ynh_check_app_version_changed)
  13. #=================================================
  14. # STANDARD UPGRADE STEPS
  15. #=================================================
  16. # STOP SYSTEMD SERVICE
  17. #=================================================
  18. ynh_script_progression --message="Stopping a systemd service..." --weight=1
  19. ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
  20. #=================================================
  21. # DOWNLOAD, CHECK AND UNPACK SOURCE
  22. #=================================================
  23. if [ "$upgrade_type" == "UPGRADE_APP" ]
  24. then
  25. ynh_script_progression --message="Upgrading source files..." --weight=1
  26. # Download, check integrity, uncompress and patch the source from app.src
  27. ynh_setup_source --dest_dir="$install_dir"
  28. fi
  29. chmod -R o-rwx "$install_dir"
  30. chown -R $app:www-data "$install_dir"
  31. #=================================================
  32. # UPGRADE DEPENDENCIES
  33. #=================================================
  34. ynh_script_progression --message="Upgrading dependencies..." --weight=1
  35. # Install Nodejs
  36. ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
  37. #=================================================
  38. # NGINX CONFIGURATION
  39. #=================================================
  40. ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
  41. # Create a dedicated NGINX config
  42. ynh_add_nginx_config
  43. #=================================================
  44. # SETUP SYSTEMD
  45. #=================================================
  46. ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
  47. env_path="$PATH"
  48. # Create a dedicated systemd config
  49. ynh_add_systemd_config
  50. #=================================================
  51. # INTEGRATE SERVICE IN YUNOHOST
  52. #=================================================
  53. ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
  54. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  55. #=================================================
  56. # START SYSTEMD SERVICE
  57. #=================================================
  58. ynh_script_progression --message="Starting a systemd service..." --weight=1
  59. ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
  60. #=================================================
  61. # END OF SCRIPT
  62. #=================================================
  63. ynh_script_progression --message="Upgrade of $app completed" --last