2018-06-14 02:13:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2018-08-31 01:11:12 +02:00
|
|
|
source _common.sh
|
2018-06-14 02:13:59 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
ssh_user=$(ynh_app_setting_get $app ssh_user)
|
2022-09-30 01:16:55 +02:00
|
|
|
datadir=$(ynh_app_setting_get $app ssh_user)
|
2018-06-14 02:13:59 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2021-01-11 00:36:16 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies..."
|
|
|
|
|
2018-06-14 02:13:59 +02:00
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
2021-04-08 20:20:10 +02:00
|
|
|
# Remove borg if we are removing the last borg app on the system
|
|
|
|
if [ "$(yunohost app list | grep "id: borg" | wc -l)" == "1" ] ; then
|
|
|
|
ynh_secure_remove "/opt/borg-env"
|
|
|
|
ynh_secure_remove "/usr/local/bin/borg"
|
|
|
|
fi
|
|
|
|
|
2018-06-14 02:13:59 +02:00
|
|
|
#=================================================
|
2021-04-08 20:20:10 +02:00
|
|
|
# REMOVE USER BUT KEEP FILES
|
2018-06-14 02:13:59 +02:00
|
|
|
#=================================================
|
2021-04-08 20:20:10 +02:00
|
|
|
# We keep files cause we don't know what the user want to do about
|
|
|
|
# backups stored in the home directory
|
2021-05-07 19:29:23 +02:00
|
|
|
ynh_system_user_delete --username=$ssh_user
|
2021-01-11 00:36:16 +01:00
|
|
|
|
2022-09-30 01:16:55 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DATA DIR
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the data directory if --purge option is used
|
|
|
|
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing app data directory..." --weight=1
|
|
|
|
ynh_secure_remove --file="$datadir"
|
|
|
|
fi
|
|
|
|
|
2021-04-08 20:20:10 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE CRON FILES
|
|
|
|
#=================================================
|
|
|
|
ynh_secure_remove "/etc/cron.d/$app"
|
|
|
|
|
2021-01-11 00:36:16 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|