2015-10-21 13:03:49 +02:00
|
|
|
#!/bin/bash
|
2017-02-04 19:14:21 +01:00
|
|
|
set -u # treat unset variables as an error
|
2015-10-21 13:03:49 +02:00
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2017-02-04 19:20:51 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
2017-10-10 14:12:41 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2018-01-30 07:42:16 +01:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
db_name="$app"
|
2020-02-18 22:31:15 +01:00
|
|
|
db_user=$(ynh_app_setting_get $app mysqluser)
|
|
|
|
db_user=${db_user:-"mmuser"}
|
2018-01-30 07:49:02 +01:00
|
|
|
mattermost_user="$app"
|
2017-10-10 14:12:41 +02:00
|
|
|
final_path="/var/www/$app"
|
|
|
|
data_path="/home/yunohost.app/$app"
|
2017-10-17 06:49:29 +02:00
|
|
|
logs_path="/var/log/$app"
|
2015-10-21 13:03:49 +02:00
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2020-02-08 23:34:06 +01:00
|
|
|
#=================================================
|
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
|
2020-02-09 00:27:51 +01:00
|
|
|
if yunohost service status | grep -q "$app"; then
|
|
|
|
yunohost service remove "$app"
|
2020-02-08 23:34:06 +01:00
|
|
|
fi
|
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
|
|
|
|
2017-10-12 12:47:51 +02:00
|
|
|
# Remove systemd service
|
2020-02-09 00:27:51 +01:00
|
|
|
if $(systemctl -q is-active "$app"); then
|
|
|
|
systemctl stop "$app"
|
2017-10-12 12:47:51 +02:00
|
|
|
fi
|
|
|
|
ynh_remove_systemd_config
|
|
|
|
|
|
|
|
# Legacy, for older versions of this app which used supervisor
|
|
|
|
if [ -f "/etc/supervisor/conf.d/${app}.conf" ]; then
|
2020-02-09 00:27:51 +01:00
|
|
|
supervisorctl stop "$app"
|
|
|
|
ynh_secure_remove --file="/etc/supervisor/conf.d/${app}.conf"
|
2017-10-12 12:47:51 +02:00
|
|
|
fi
|
2015-10-21 13:03:49 +02:00
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE THE MYSQL DATABASE
|
|
|
|
#=================================================
|
2015-10-21 13:03:49 +02:00
|
|
|
|
2017-10-10 14:14:32 +02:00
|
|
|
ynh_mysql_remove_db "$db_user" "$db_name"
|
2015-10-21 13:03:49 +02:00
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2015-10-31 16:51:08 +01:00
|
|
|
|
2017-10-10 14:26:45 +02:00
|
|
|
ynh_secure_remove "$final_path"
|
|
|
|
ynh_secure_remove "$data_path"
|
2017-10-10 14:09:26 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2015-10-21 14:33:49 +02:00
|
|
|
|
2017-10-10 14:26:45 +02:00
|
|
|
ynh_remove_nginx_config
|
2015-10-21 14:33:49 +02:00
|
|
|
|
2017-10-10 14:09:26 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE LOG FILE
|
|
|
|
#=================================================
|
|
|
|
|
2020-02-09 00:27:51 +01:00
|
|
|
ynh_secure_remove --file="$logs_path"
|
2017-10-10 14:09:26 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
|
2018-01-30 07:49:02 +01:00
|
|
|
ynh_system_user_delete "$mattermost_user"
|