upgrade 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. source _common.sh
  3. source /usr/share/yunohost/helpers
  4. secret=$(ynh_string_random --length=24)
  5. timezone=$(cat /etc/timezone)
  6. #=================================================
  7. # STOP SYSTEMD SERVICE
  8. #=================================================
  9. ynh_script_progression "Stopping $app's systemd service..."
  10. ynh_systemctl --service=$app --action="stop" --log_path="systemd"
  11. #=================================================
  12. # DOWNLOAD, CHECK AND UNPACK SOURCE
  13. #=================================================
  14. ynh_script_progression "Upgrading source files..."
  15. ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env"
  16. #=================================================
  17. # UPGRADE DEPENDENCIES
  18. #=================================================
  19. ynh_script_progression "Upgrading dependencies..."
  20. ynh_nodejs_install
  21. #=================================================
  22. # REAPPLY SYSTEM CONFIGURATIONS
  23. #=================================================
  24. ynh_script_progression "Upgrading system configurations related to $app..."
  25. ynh_config_add_nginx
  26. ynh_config_add_systemd
  27. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  28. #=================================================
  29. # ADD A CONFIGURATION
  30. #=================================================
  31. #ynh_script_progression "Adding $app's configuration..."
  32. #ynh_config_add --template=".env" --destination="$install_dir/.env"
  33. #=================================================
  34. # INSTALL HOMARR
  35. #=================================================
  36. ynh_script_progression "Building the app..."
  37. pushd $install_dir
  38. ynh_hide_warnings ynh_exec_as_app yarn install
  39. ynh_hide_warnings ynh_exec_as_app NODE_ENV=production yarn build
  40. ynh_hide_warnings ynh_exec_as_app yarn db:migrate
  41. popd
  42. #=================================================
  43. # START SYSTEMD SERVICE
  44. #=================================================
  45. ynh_script_progression "Starting $app's systemd service..."
  46. ynh_systemctl --service=$app --action="start" --log_path="systemd"
  47. #=================================================
  48. # END OF SCRIPT
  49. #=================================================
  50. ynh_script_progression "Upgrade of $app completed"