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

44 lines
1,010 B
Text
Raw Normal View History

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
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"
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
sudo userdel -r "$app"
2016-08-15 15:38:50 +02:00
# Remove init script
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
sudo yunohost service remove "$app"
2016-08-15 15:38:50 +02:00
# Reload services
sudo systemctl restart rsyslog.service || true
sudo systemctl reload nginx.service || true