upgrade 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. # Download, check integrity, uncompress and patch the source from app.src
  16. ynh_setup_source --dest_dir="$install_dir" --full_replace
  17. #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"
  18. #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"
  19. #=================================================
  20. # UPGRADE DEPENDENCIES
  21. #=================================================
  22. ynh_script_progression "Upgrading dependencies..."
  23. # Install Nodejs
  24. ynh_nodejs_install
  25. #=================================================
  26. # REAPPLY SYSTEM CONFIGURATIONS
  27. #=================================================
  28. ynh_script_progression "Upgrading system configurations related to $app..."
  29. # Create a dedicated NGINX config
  30. ynh_config_add_nginx
  31. # Create a dedicated systemd config
  32. ynh_config_add_systemd
  33. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  34. #=================================================
  35. # ADD A CONFIGURATION
  36. #=================================================
  37. ynh_script_progression "Adding $app's configuration..."
  38. ynh_config_add --template=".env" --destination="$install_dir/.env"
  39. #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env"
  40. #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env"
  41. #=================================================
  42. # INSTALL HOMARR
  43. #=================================================
  44. ynh_script_progression "Building the app..."
  45. pushd $install_dir
  46. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install
  47. ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production yarn build
  48. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn db:migrate
  49. popd
  50. #=================================================
  51. # START SYSTEMD SERVICE
  52. #=================================================
  53. ynh_script_progression "Starting $app's systemd service..."
  54. ynh_systemctl --service=$app --action="start" --log_path="systemd"
  55. #=================================================
  56. # END OF SCRIPT
  57. #=================================================
  58. ynh_script_progression "Upgrade of $app completed"