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

remove: use more variables instead of hardcoded values

This commit is contained in:
Pierre de La Morinerie 2017-10-10 17:42:41 +05:30
parent c2e27b9764
commit 1a40ff1eed

View file

@ -13,9 +13,12 @@ source /usr/share/yunohost/helpers
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get mattermost domain)
db_name="mattermost"
db_user="mmuser"
final_path="/var/www/$app"
data_path="/home/yunohost.app/$app"
#=================================================
# STANDARD REMOVE
@ -23,8 +26,8 @@ db_user="mmuser"
# STOP AND REMOVE SERVICE
#=================================================
sudo supervisorctl stop mattermost
sudo rm -f /etc/supervisor/conf.d/mattermost.conf
sudo supervisorctl stop "$app"
sudo rm -f "/etc/supervisor/conf.d/${app}.conf"
#=================================================
# REMOVE THE MYSQL DATABASE
@ -37,23 +40,23 @@ ynh_mysql_execute_as_root "DROP DATABASE IF EXISTS $db_name ; DROP USER $db_user
# REMOVE APP MAIN DIR
#=================================================
sudo rm -rf /var/www/mattermost
sudo rm -rf /home/yunohost.app/mattermost
sudo rm -rf "$final_path"
sudo rm -rf "$data_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
sudo rm -f /etc/nginx/conf.d/$domain.d/mattermost.conf
sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
#=================================================
# REMOVE LOG FILE
#=================================================
sudo rm -f "/var/log/mattermost.log"
sudo rm -f "/var/log/${app}.log"
#=================================================
# REMOVE DEDICATED USER
#=================================================
sudo userdel mattermost
sudo userdel "$app"