install 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. # INSTALL DEPENDENCIES
  11. #=================================================
  12. ynh_script_progression --message="Installing dependencies..." --weight=1
  13. # Install Nodejs
  14. ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
  15. #=================================================
  16. # DOWNLOAD, CHECK AND UNPACK SOURCE
  17. #=================================================
  18. ynh_script_progression --message="Setting up source files..." --weight=1
  19. # Download, check integrity, uncompress and patch the source from app.src
  20. ynh_setup_source --dest_dir="$install_dir"
  21. chmod -R o-rwx "$install_dir"
  22. chown -R $app:www-data "$install_dir"
  23. #=================================================
  24. # NGINX CONFIGURATION
  25. #=================================================
  26. ynh_script_progression --message="Configuring NGINX web server..." --weight=1
  27. # Create a dedicated NGINX config
  28. ynh_add_nginx_config
  29. #=================================================
  30. # INSTALL HOMARR
  31. #=================================================
  32. ynh_script_progression --message="Building the app..." --weight=20
  33. pushd $install_dir
  34. ynh_use_nodejs
  35. ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install
  36. ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn build
  37. popd
  38. #=================================================
  39. # SETUP SYSTEMD
  40. #=================================================
  41. ynh_script_progression --message="Configuring a systemd service..." --weight=1
  42. env_path="$PATH"
  43. # Create a dedicated systemd config
  44. ynh_add_systemd_config
  45. #=================================================
  46. # INTEGRATE SERVICE IN YUNOHOST
  47. #=================================================
  48. ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
  49. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  50. #=================================================
  51. # START SYSTEMD SERVICE
  52. #=================================================
  53. ynh_script_progression --message="Starting a systemd service..." --weight=1
  54. # Start a systemd service
  55. ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
  56. #=================================================
  57. # END OF SCRIPT
  58. #=================================================
  59. ynh_script_progression --message="Installation of $app completed" --last