remove 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # 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
  20. then
  21. ynh_script_progression --message="Removing $app service integration..." --weight=2
  22. ynh_remove_systemd_config --service=$flohmarkt_filename
  23. yunohost service remove $flohmarkt_filename
  24. fi
  25. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/12
  26. ynh_script_progression --message="Removing database and database user..." --weight=2
  27. # remove DB
  28. flohmarkt_ynh_delete_couchdb_db
  29. # remove DB user for this instance:
  30. flohmarkt_ynh_delete_couchdb_user
  31. # Remove the app-specific logrotate config
  32. ynh_script_progression --message="Removing logrotate configuration..." --weight=2
  33. ynh_remove_logrotate
  34. # remove logfiles directory
  35. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
  36. # can only remove a subdir or one file
  37. ynh_script_progression --message="Removing logfiles..." --weight=2
  38. ynh_secure_remove --file="${flohmarkt_log_dir}"
  39. # Remove the dedicated NGINX config
  40. ynh_script_progression --message="Removing nginx configuration..." --weight=2
  41. ynh_remove_nginx_config
  42. # Remove the dedicated Fail2Ban config
  43. ynh_script_progression --message="Removing fail2ban configuration..." --weight=2
  44. ynh_remove_fail2ban_config
  45. # Remove home
  46. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
  47. ynh_script_progression --message="Removing data directory..." --weight=2
  48. ynh_secure_remove --file=$data_dir
  49. # remove systemd service
  50. ynh_script_progression --message="Removing data directory..." --weight=2
  51. ynh_remove_systemd_config
  52. # remove symlinks
  53. ynh_script_progression --message="Removing symlinks..." --weight=2
  54. ynh_secure_remove --file="$flohmarkt_sym_install"
  55. ynh_secure_remove --file="$flohmarkt_sym_data_dir"
  56. ynh_secure_remove --file="$flohmarkt_sym_log_dir"
  57. #=================================================
  58. # END OF SCRIPT
  59. #=================================================
  60. ynh_script_progression --message="Removal of $app completed" --last