remove 2.9 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. yunohost service remove $flohmarkt_filename
  23. fi
  24. ## This needs to be rewritten: Only delete the database of the instance being removed
  25. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/12
  26. # ynh_script_progression --message="Stopping couchdb..." --weight=2
  27. # systemctl stop couchdb
  28. #
  29. # ynh_script_progression --message="Removing databases..." --weight=2
  30. # # remove flohmarkt database and database user
  31. # # ynh_script_progression --message="removing flohmarkt couchdb user and database" --weight=2
  32. # # @@ wie komme ich hier an das admin-password, falls ich es brauche?
  33. # # * brauche ich es? → ja
  34. # # db:
  35. # # curl -X DELETE 'http://127.0.0.1:5984/flohmarkt' --user '<admin-user>:<admin-password>'
  36. # # user:
  37. # # curl -X DELETE "http://127.0.0.1:5984/_users/org.couchdb.user%3Aflohmarkt?rev=`curl -sX GET 'http://127.0.0.1:5984/_users/org.couchdb.user%3Aflohmarkt' --user 'admin:bla42fasel' | jq -r ._rev`" --user '<admin-user>:<admin-password>'
  38. # # @@ todo improve this like above
  39. # # https://codeberg.org/ChriChri/flohmarkt_ynh/issues/12
  40. # ynh_secure_remove --file=/var/lib/couchdb
  41. # Remove the app-specific logrotate config
  42. ynh_remove_logrotate
  43. # remove logfiles directory
  44. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
  45. # can only remove a subdir or one file
  46. ynh_secure_remove --file="${flohmarkt_log_dir}"
  47. # Remove the dedicated NGINX config
  48. ynh_remove_nginx_config
  49. # Remove the dedicated Fail2Ban config
  50. ynh_remove_fail2ban_config
  51. # Remove home
  52. # https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/29
  53. ynh_script_progression --message="Removing data directory..." --weight=2
  54. ynh_secure_remove --file=$data_dir
  55. # remove systemd service
  56. ynh_script_progression --message="Removing data directory..." --weight=2
  57. ynh_remove_systemd_config
  58. #=================================================
  59. # END OF SCRIPT
  60. #=================================================
  61. ynh_script_progression --message="Removal of $app completed" --last