install 2.9 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. # INSTALL DEPENDENCIES
  8. #=================================================
  9. ynh_script_progression "Installing dependencies..."
  10. # Install Nodejs
  11. ynh_nodejs_install
  12. #=================================================
  13. # DOWNLOAD, CHECK AND UNPACK SOURCE
  14. #=================================================
  15. ynh_script_progression "Setting up source files..."
  16. # Download, check integrity, uncompress and patch the source from app.src
  17. ynh_setup_source --dest_dir="$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 | chmod -R o-rwx "$install_dir"
  19. #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"
  20. #=================================================
  21. # APP INITIAL CONFIGURATION
  22. #=================================================
  23. ynh_script_progression "Adding $app's configuration files..."
  24. # Create a dedicated NGINX config
  25. ynh_config_add_nginx
  26. # Create a dedicated systemd config
  27. ynh_config_add_systemd
  28. yunohost service add $app --description="Customizable browser's home page" --log="/var/log/$app/$app.log"
  29. #=================================================
  30. # ADD A CONFIGURATION
  31. #=================================================
  32. ynh_script_progression "Adding $app's configuration..."
  33. ynh_config_add --template=".env" --destination="$install_dir/.env"
  34. #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"
  35. #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"
  36. #=================================================
  37. # INSTALL HOMARR
  38. #=================================================
  39. ynh_script_progression "Building the app..."
  40. pushd $install_dir
  41. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn install
  42. ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production yarn build
  43. ynh_hide_warnings ynh_exec_as_app node_load_PATH yarn db:migrate
  44. popd
  45. #=================================================
  46. # START SYSTEMD SERVICE
  47. #=================================================
  48. ynh_script_progression "Starting $app's systemd service..."
  49. # Start a systemd service
  50. ynh_systemctl --service=$app --action="start"
  51. #=================================================
  52. # END OF SCRIPT
  53. #=================================================
  54. ynh_script_progression "Installation of $app completed"