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

47 lines
1.5 KiB
Text
Raw Normal View History

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
2022-03-13 17:45:45 +01:00
#=================================================
2024-05-25 09:34:34 +02:00
# REMOVE SYSTEM CONFIGURATIONS
2022-03-13 17:45:45 +01:00
#=================================================
2024-05-25 09:34:34 +02:00
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
2024-05-25 22:25:00 +02:00
ynh_systemd_action --service="$app$suffix.timer" --action="stop"
ynh_systemd_action --service="$app$suffix.timer" --action="disable"
2024-05-25 09:34:34 +02:00
ynh_remove_systemd_config --service="$app$suffix"
ynh_secure_remove "/etc/systemd/system/$app$suffix.timer"
done
2022-03-13 17:45:45 +01:00
# Remove the app-specific logrotate config
ynh_remove_logrotate
2024-05-25 09:34:34 +02:00
# Remove sudoers
rm "/etc/sudoers.d/$app"
2022-03-13 17:45:45 +01:00
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
#=================================================
# REMOVE SSH CONFIG
#=================================================
ynh_script_progression --message="Removing ssh config"
2022-03-13 17:45:45 +01:00
2024-05-25 09:34:34 +02:00
sed -e "/begin ${app}/,/end ${app}/{/.*/d}" /root/.ssh/config -i || true
2022-03-13 17:45:45 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"