2018-02-25 21:45:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Load common variables and helpers
|
|
|
|
source ./experimental_helper.sh
|
|
|
|
source ./_common.sh
|
|
|
|
|
2020-11-17 23:33:50 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
|
|
|
# Retrieve domain from app settings
|
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
|
2018-02-25 21:45:24 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
|
2019-02-14 09:58:05 +01:00
|
|
|
# Stop gitea
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Stoping services..."
|
2018-02-25 21:45:24 +01:00
|
|
|
systemctl stop "$app".service
|
|
|
|
|
|
|
|
# Drop MySQL database and user
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing databases..."
|
2018-02-25 21:45:24 +01:00
|
|
|
ynh_mysql_drop_db "$dbname" 2>/dev/null
|
|
|
|
ynh_mysql_drop_user "$dbuser" 2>/dev/null
|
|
|
|
|
|
|
|
# Delete app directory and configurations
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing code..."
|
2019-06-09 21:05:14 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing user data..."
|
2019-06-09 21:05:14 +02:00
|
|
|
ynh_secure_remove --file="$DATADIR"
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing logs..."
|
2019-06-09 21:05:14 +02:00
|
|
|
ynh_secure_remove --file="/var/log/$app"
|
2018-02-25 21:45:24 +01:00
|
|
|
|
|
|
|
# Remove the app-specific logrotate config
|
|
|
|
ynh_remove_logrotate
|
|
|
|
|
|
|
|
# Remove nginx config
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing nginx configuration..."
|
2018-02-25 21:45:24 +01:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
2019-02-14 09:58:05 +01:00
|
|
|
# Remove gitea user and data
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2018-02-25 21:45:24 +01:00
|
|
|
ynh_system_user_delete $app
|
|
|
|
|
|
|
|
# Remove init script
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing systemd units..."
|
2018-02-25 21:45:24 +01:00
|
|
|
ynh_remove_systemd_config
|
|
|
|
|
|
|
|
# Remove monitor
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing gitea service..."
|
2018-06-12 14:32:44 +02:00
|
|
|
yunohost service remove "$app"
|
|
|
|
|
2019-08-01 15:06:04 +02:00
|
|
|
# Remove fail2ban config
|
2019-09-10 22:43:45 +02:00
|
|
|
ynh_script_progression --message="Removing fail2ban configuration..."
|
2019-08-01 15:06:04 +02:00
|
|
|
ynh_remove_fail2ban_config
|
|
|
|
|
2019-10-27 14:54:35 +01:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|