remove 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 APP MAIN DIR
  27. #=================================================
  28. ynh_script_progression --message="Removing app main directory..." --weight=1
  29. # Remove the app directory securely
  30. ynh_secure_remove --file="$final_path"
  31. #=================================================
  32. # REMOVE NGINX CONFIGURATION
  33. #=================================================
  34. ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
  35. # Remove the dedicated NGINX config
  36. ynh_remove_nginx_config
  37. #=================================================
  38. # REMOVE PHP-FPM CONFIGURATION
  39. #=================================================
  40. ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
  41. # Remove the dedicated PHP-FPM config
  42. ynh_remove_fpm_config
  43. #=================================================
  44. # GENERIC FINALIZATION
  45. #=================================================
  46. # REMOVE DEDICATED USER
  47. #=================================================
  48. ynh_script_progression --message="Removing the dedicated system user..." --weight=1
  49. # Delete a system user
  50. ynh_system_user_delete --username=$app
  51. #=================================================
  52. # END OF SCRIPT
  53. #=================================================
  54. ynh_script_progression --message="Removal of $app completed" --last