2016-08-15 15:38:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Load common variables and helpers
|
|
|
|
source ./_common.sh
|
|
|
|
|
|
|
|
# Set app specific variables
|
|
|
|
app=$APPNAME
|
|
|
|
dbname=$app
|
|
|
|
dbuser=$app
|
|
|
|
|
|
|
|
# Source app helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop gogs
|
2016-10-11 22:18:56 +02:00
|
|
|
sudo systemctl stop "$app".service
|
2016-08-15 15:38:50 +02:00
|
|
|
|
|
|
|
# Drop MySQL database and user
|
|
|
|
ynh_mysql_drop_db "$dbname" 2>/dev/null || true
|
|
|
|
ynh_mysql_drop_user "$dbuser" 2>/dev/null || true
|
|
|
|
|
|
|
|
# Retrieve domain from app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
|
|
|
# Delete app directory and configurations
|
|
|
|
sudo rm -rf "/opt/${app}"
|
|
|
|
[[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
2016-10-11 22:18:56 +02:00
|
|
|
sudo rm -rf /var/log/"$app"
|
|
|
|
sudo rm -f /etc/logrotate.d/"$app"
|
2016-08-15 15:38:50 +02:00
|
|
|
|
|
|
|
# Remove gogs user and data
|
2016-10-11 22:18:56 +02:00
|
|
|
sudo userdel -r "$app"
|
2016-08-15 15:38:50 +02:00
|
|
|
|
|
|
|
# Remove init script
|
2016-10-11 22:18:56 +02:00
|
|
|
sudo systemctl disable "$app".service
|
|
|
|
sudo rm -f /etc/systemd/system/"$app".service
|
2016-08-15 15:38:50 +02:00
|
|
|
sudo systemctl daemon-reload
|
|
|
|
|
|
|
|
# Remove monitor
|
2016-10-11 22:18:56 +02:00
|
|
|
sudo yunohost service remove "$app"
|
2016-08-15 15:38:50 +02:00
|
|
|
|
|
|
|
# Reload services
|
2016-10-11 21:55:26 +02:00
|
|
|
sudo systemctl restart rsyslog.service || true
|
|
|
|
sudo systemctl reload nginx.service || true
|