upgrade 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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
  16. #chmod -R o-rwx "$install_dir"
  17. #chown -R $app:www-data "$install_dir"
  18. #=================================================
  19. # UPGRADE DEPENDENCIES
  20. #=================================================
  21. ynh_script_progression "Upgrading dependencies..."
  22. ynh_nodejs_install
  23. #=================================================
  24. # REAPPLY SYSTEM CONFIGURATIONS
  25. #=================================================
  26. ynh_script_progression "Upgrading system configurations related to $app..."
  27. ynh_config_add_nginx
  28. ynh_config_add_systemd
  29. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  30. #=================================================
  31. # ADD A CONFIGURATION
  32. #=================================================
  33. ynh_script_progression "Adding $app's configuration..."
  34. ynh_config_add --template=".env" --destination="$install_dir/.env"
  35. #=================================================
  36. # INSTALL HOMARR
  37. #=================================================
  38. ynh_script_progression "Building the app..."
  39. pushd $install_dir
  40. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install
  41. ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production yarn build
  42. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn db:migrate
  43. popd
  44. #=================================================
  45. # START SYSTEMD SERVICE
  46. #=================================================
  47. ynh_script_progression "Starting $app's systemd service..."
  48. ynh_systemctl --service=$app --action="start" --log_path="systemd"
  49. #=================================================
  50. # END OF SCRIPT
  51. #=================================================
  52. ynh_script_progression "Upgrade of $app completed"