yunohost-gitea_ynh/scripts/remove
2019-09-07 13:12:25 +02:00

52 lines
1.2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
#=================================================
# STANDARD REMOVE
#=================================================
# Stop gitea
systemctl stop "$app".service
# Drop MySQL database and user
ynh_mysql_drop_db "$dbname" 2>/dev/null
ynh_mysql_drop_user "$dbuser" 2>/dev/null
# Retrieve domain from app settings
domain=$(ynh_app_setting_get --app $app --key domain)
# Delete app directory and configurations
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file="$DATADIR"
ynh_secure_remove --file="/var/log/$app"
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove nginx config
ynh_remove_nginx_config
# Remove gitea user and data
ynh_system_user_delete $app
# Remove init script
ynh_remove_systemd_config
# Remove monitor
yunohost service remove "$app"
# Remove fail2ban config
ynh_remove_fail2ban_config
true # Do not fail if remove after install error