remove 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. rm -rf /var/lib/couchdb
  38. # Remove the app-specific logrotate config
  39. ynh_remove_logrotate
  40. # Remove the dedicated NGINX config
  41. ynh_remove_nginx_config
  42. # Remove the dedicated Fail2Ban config
  43. ynh_remove_fail2ban_config
  44. #=================================================
  45. # END OF SCRIPT
  46. #=================================================
  47. ynh_script_progression --message="Removal of $app completed" --last