remove 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 $app
  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 $app >/dev/null
  20. then
  21. ynh_script_progression --message="Removing $app service integration..." --weight=2
  22. yunohost service remove $app
  23. fi
  24. ynh_script_progression --message="Stopping couchdb..." --weight=2
  25. systemctl stop couchdb
  26. ynh_script_progression --message="Removing databases..." --weight=2
  27. # remove flohmarkt database and database user
  28. # ynh_script_progression --message="removing flohmarkt couchdb user and database" --weight=2
  29. # @@ wie komme ich hier an das admin-password, falls ich es brauche?
  30. # * brauche ich es? → ja
  31. # db:
  32. # curl -X DELETE 'http://127.0.0.1:5984/flohmarkt' --user '<admin-user>:<admin-password>'
  33. # user:
  34. # 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>'
  35. # @@ todo improve this like above
  36. # https://codeberg.org/ChriChri/flohmarkt_ynh/issues/12
  37. ynh_secure_remove --file=/var/lib/couchdb
  38. # Remove the app-specific logrotate config
  39. ynh_remove_logrotate
  40. # remove log directory
  41. ynh_secure_remove --file="/var/log/$app/$app.log"
  42. # Remove the dedicated NGINX config
  43. ynh_remove_nginx_config
  44. # Remove the dedicated Fail2Ban config
  45. ynh_remove_fail2ban_config
  46. # Remove home
  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. #=================================================
  53. # END OF SCRIPT
  54. #=================================================
  55. ynh_script_progression --message="Removal of $app completed" --last