1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/restic_ynh.git synced 2024-09-03 20:16:22 +02:00
restic_ynh/scripts/remove
2024-05-25 09:45:18 +02:00

46 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Systemd services and timers
for suffix in "${systemd_services_suffixes[@]}"; do
if ynh_exec_warn_less yunohost service status "$app_suffix" >/dev/null; then
yunohost service remove "$app_suffix"
fi
systemctl stop "$app$suffix.timer"
systemctl --quiet disable "$app$suffix.timer"
ynh_remove_systemd_config --service="$app$suffix"
ynh_secure_remove "/etc/systemd/system/$app$suffix.timer"
done
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove sudoers
rm "/etc/sudoers.d/$app"
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
#=================================================
# REMOVE SSH CONFIG
#=================================================
ynh_script_progression --message="Removing ssh config"
sed -e "/begin ${app}/,/end ${app}/{/.*/d}" /root/.ssh/config -i || true
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"