remove 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. #=================================================
  3. # GENERIC START
  4. #=================================================
  5. # IMPORT GENERIC HELPERS
  6. #=================================================
  7. source /usr/share/yunohost/helpers
  8. source _common.sh
  9. #=================================================
  10. # STANDARD REMOVE
  11. #=================================================
  12. # REMOVE SERVICE INTEGRATION IN YUNOHOST
  13. #=================================================
  14. ynh_script_progression --message="Removing system configurations related to $app..." --weight=5
  15. # Stop flohmarkt service
  16. ynh_script_progression --message="Stopping $app..." --weight=2
  17. yunohost service stop $flohmarkt_filename
  18. # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
  19. if ynh_exec_warn_less yunohost service status $flohmarkt_filename >/dev/null; then
  20. ynh_script_progression --message="Removing $app service integration..." --weight=2
  21. ynh_remove_systemd_config --service=$flohmarkt_filename
  22. yunohost service remove $flohmarkt_filename
  23. fi
  24. # remove DB user for this instance - a new install will create a new user and permissions
  25. ynh_script_progression --message="Removing couchdb user..." --weight=2
  26. flohmarkt_ynh_delete_couchdb_user
  27. if [[ $YNH_APP_PURGE -eq 1 ]]; then
  28. ynh_script_progression --message="Purging couchdb database ..." --weight=2
  29. # remove DB
  30. flohmarkt_ynh_delete_couchdb_db
  31. # remove logfiles directory
  32. ynh_script_progression --message="Purging logfiles..." --weight=2
  33. ynh_secure_remove --file="${flohmarkt_log_dir}"
  34. else
  35. ynh_script_progression --message="Purge not selected - not deleting couchdb and logfiles..." --weight=1
  36. fi
  37. # Remove the app-specific logrotate config
  38. ynh_script_progression --message="Removing logrotate configuration..." --weight=2
  39. ynh_remove_logrotate
  40. # Remove the dedicated NGINX config
  41. ynh_script_progression --message="Removing nginx configuration..." --weight=2
  42. ynh_remove_nginx_config
  43. # Remove the dedicated Fail2Ban config
  44. ynh_script_progression --message="Removing fail2ban configuration..." --weight=2
  45. ynh_remove_fail2ban_config
  46. # remove systemd service
  47. ynh_script_progression --message="Removing systemd.service directory..." --weight=2
  48. ynh_remove_systemd_config
  49. # remove symlinks
  50. ynh_script_progression --message="Removing symlinks..." --weight=2
  51. # no ynh_secure_remove:
  52. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/52
  53. rm "$flohmarkt_sym_install" || true
  54. rm "$flohmarkt_sym_data_dir" || true
  55. rm "$flohmarkt_sym_log_dir" || true
  56. #=================================================
  57. # END OF SCRIPT
  58. #=================================================
  59. ynh_script_progression --message="Removal of $app completed" --last