remove 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. db_name=$(ynh_app_setting_get --app=$app --key=db_name)
  17. db_user=$db_name
  18. final_path=$(ynh_app_setting_get --app=$app --key=final_path)
  19. #=================================================
  20. # REMOVE THE MYSQL DATABASE
  21. #=================================================
  22. ynh_script_progression --message="Removing the MySQL database..." --weight=2
  23. # Remove a database if it exists, along with the associated user
  24. ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
  25. #=================================================
  26. # REMOVE DEPENDENCIES
  27. #=================================================
  28. ynh_script_progression --message="Removing dependencies..." --weight=1
  29. # Remove metapackage and its dependencies
  30. ynh_remove_app_dependencies
  31. #=================================================
  32. # REMOVE APP MAIN DIR
  33. #=================================================
  34. ynh_script_progression --message="Removing app main directory..." --weight=1
  35. # Remove the app directory securely
  36. ynh_secure_remove --file="$final_path"
  37. #=================================================
  38. # REMOVE NGINX CONFIGURATION
  39. #=================================================
  40. ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
  41. # Remove the dedicated NGINX config
  42. ynh_remove_nginx_config
  43. #=================================================
  44. # REMOVE PHP-FPM CONFIGURATION
  45. #=================================================
  46. ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
  47. # Remove the dedicated PHP-FPM config
  48. ynh_remove_fpm_config
  49. #=================================================
  50. # GENERIC FINALIZATION
  51. #=================================================
  52. # REMOVE DEDICATED USER
  53. #=================================================
  54. ynh_script_progression --message="Removing the dedicated system user..." --weight=1
  55. # Delete a system user
  56. ynh_system_user_delete --username=$app
  57. #=================================================
  58. # END OF SCRIPT
  59. #=================================================
  60. ynh_script_progression --message="Removal of $app completed" --last