remove 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. # LOAD SETTINGS
  11. #=================================================
  12. ynh_script_progression --message="Loading installation settings..." --weight=1
  13. app=$YNH_APP_INSTANCE_NAME
  14. domain=$(ynh_app_setting_get --app=$app --key=domain)
  15. port=$(ynh_app_setting_get --app=$app --key=port)
  16. final_path=$(ynh_app_setting_get --app=$app --key=final_path)
  17. #=================================================
  18. # STANDARD REMOVE
  19. #=================================================
  20. # REMOVE SERVICE INTEGRATION IN YUNOHOST
  21. #=================================================
  22. # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
  23. if ynh_exec_warn_less yunohost service status $app >/dev/null
  24. then
  25. ynh_script_progression --message="Removing $app service integration..." --weight=1
  26. yunohost service remove $app
  27. fi
  28. #=================================================
  29. # STOP AND REMOVE SERVICE
  30. #=================================================
  31. ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
  32. # Remove the dedicated systemd config
  33. ynh_remove_systemd_config
  34. #=================================================
  35. # REMOVE APP MAIN DIR
  36. #=================================================
  37. ynh_script_progression --message="Removing app main directory..." --weight=1
  38. # Remove the app directory securely
  39. ynh_secure_remove --file="$final_path"
  40. #=================================================
  41. # REMOVE NGINX CONFIGURATION
  42. #=================================================
  43. ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
  44. # Remove the dedicated NGINX config
  45. ynh_remove_nginx_config
  46. #=================================================
  47. # REMOVE DEPENDENCIES
  48. #=================================================
  49. ynh_script_progression --message="Removing dependencies..." --weight=1
  50. # Remove NodeJS
  51. ynh_remove_nodejs
  52. #=================================================
  53. # GENERIC FINALIZATION
  54. #=================================================
  55. # REMOVE DEDICATED USER
  56. #=================================================
  57. ynh_script_progression --message="Removing the dedicated system user..." --weight=1
  58. # Delete a system user
  59. ynh_system_user_delete --username=$app
  60. #=================================================
  61. # END OF SCRIPT
  62. #=================================================
  63. ynh_script_progression --message="Removal of $app completed" --last