#!/bin/bash set -u # treat unset variables as an error #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= domain=$(ynh_app_setting_get mattermost domain) db_name="mattermost" db_user="mmuser" #================================================= # STANDARD REMOVE #================================================= # STOP AND REMOVE SERVICE #================================================= sudo supervisorctl stop mattermost sudo rm -f /etc/supervisor/conf.d/mattermost.conf #================================================= # REMOVE THE MYSQL DATABASE #================================================= # (DROP USER IF EXISTS is only available on MySQL >= 5.7, so we don't use it for now) ynh_mysql_execute_as_root "DROP DATABASE IF EXISTS $db_name ; DROP USER $db_user@localhost ;" #================================================= # REMOVE APP MAIN DIR #================================================= sudo rm -rf /var/www/mattermost sudo rm -rf /home/yunohost.app/mattermost #================================================= # REMOVE NGINX CONFIGURATION #================================================= sudo rm -f /etc/nginx/conf.d/$domain.d/mattermost.conf #================================================= # REMOVE LOG FILE #================================================= sudo rm -f "/var/log/mattermost.log" #================================================= # REMOVE DEDICATED USER #================================================= sudo userdel mattermost