1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00
flohmarkt_ynh/scripts/remove

68 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_script_progression "Removing system configurations related to $app..."
# Stop flohmarkt service
ynh_script_progression "Stopping $app..."
yunohost service stop $flohmarkt_filename
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $flohmarkt_filename >/dev/null; then
ynh_script_progression "Removing $app service integration..."
ynh_config_remove_systemd$flohmarkt_filename
yunohost service remove $flohmarkt_filename
fi
# remove DB user for this instance - a new install will create a new user and permissions
ynh_script_progression "Removing couchdb user..."
flohmarkt_ynh_delete_couchdb_user
if [[ $YNH_APP_PURGE -eq 1 ]]; then
ynh_script_progression "Purging couchdb database ..."
# remove DB
flohmarkt_ynh_delete_couchdb_db
# remove logfiles directory
ynh_script_progression "Purging logfiles..."
ynh_safe_rm "${flohmarkt_log_dir}"
else
ynh_script_progression "Purge not selected - not deleting couchdb and logfiles..."
fi
# Remove the app-specific logrotate config
ynh_script_progression "Removing logrotate configuration..."
ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_script_progression "Removing nginx configuration..."
ynh_config_remove_nginx
# Remove the dedicated Fail2Ban config
ynh_script_progression "Removing fail2ban configuration..."
ynh_config_remove_fail2ban
# remove systemd service
ynh_script_progression "Removing systemd.service directory..."
ynh_config_remove_systemd
# remove symlinks
ynh_script_progression "Removing symlinks..."
# no ynh_safe_rm :
# https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/52
rm "$flohmarkt_sym_install" || true
rm "$flohmarkt_sym_data_dir" || true
rm "$flohmarkt_sym_log_dir" || true
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Removal of $app completed"