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

82 lines
2.2 KiB
Text
Raw Normal View History

2015-10-21 13:03:49 +02:00
#!/bin/bash
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
#=================================================
source /usr/share/yunohost/helpers
2017-10-10 14:09:26 +02:00
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
db_name="$app"
2015-10-21 13:03:49 +02:00
db_user="mmuser"
mattermost_user="$app"
final_path="/var/www/$app"
data_path="/home/yunohost.app/$app"
logs_path="/var/log/$app"
2015-10-21 13:03:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# STANDARD REMOVE
#=================================================
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if yunohost service status | grep -q "$app"; then
yunohost service remove "$app"
fi
2017-10-10 14:09:26 +02:00
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
# Remove systemd service
if $(systemctl -q is-active "$app"); then
systemctl stop "$app"
fi
ynh_remove_systemd_config
# Legacy, for older versions of this app which used supervisor
if [ -f "/etc/supervisor/conf.d/${app}.conf" ]; then
supervisorctl stop "$app"
ynh_secure_remove --file="/etc/supervisor/conf.d/${app}.conf"
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
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
#=================================================
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
ynh_remove_nginx_config
2015-10-21 14:33:49 +02:00
2017-10-10 14:09:26 +02:00
#=================================================
# REMOVE LOG FILE
#=================================================
ynh_secure_remove --file="$logs_path"
2017-10-10 14:09:26 +02:00
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_system_user_delete "$mattermost_user"