2017-06-10 10:10:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
source _common.sh
|
2017-06-10 10:10:31 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
2018-12-19 00:02:20 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2019-03-16 02:38:12 +01:00
|
|
|
|
2019-05-09 01:13:48 +02:00
|
|
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
|
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
|
|
|
portUnicorn=$(ynh_app_setting_get --app="$app" --key=unicorn_port)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
2018-12-19 00:02:20 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2019-03-24 21:36:20 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
|
|
|
then
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removing $app service" --weight=1
|
2019-03-24 21:36:20 +01:00
|
|
|
yunohost service remove "gitlab-runsvdir"
|
|
|
|
fi
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-03-16 02:38:12 +01:00
|
|
|
# STOP GITLAB
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Stopping gitlab" --weight=8
|
2019-01-26 14:30:58 +01:00
|
|
|
|
2019-02-01 23:24:57 +01:00
|
|
|
gitlab-ctl stop
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-03-16 02:38:12 +01:00
|
|
|
# REMOVE GITLAB
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removing Gitlab" --weight=4
|
2018-12-19 00:02:20 +01:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
dpkg --remove gitlab-ce
|
2017-06-29 21:39:47 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies" --weight=3
|
2018-12-19 00:02:20 +01:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
# Remove metapackage and its dependencies
|
2018-12-16 23:05:12 +01:00
|
|
|
ynh_remove_app_dependencies
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE APP MAIN DIR
|
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory" --weight=1
|
2018-12-19 00:02:20 +01:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
# Remove the app directory securely
|
2019-05-09 01:13:48 +02:00
|
|
|
ynh_secure_remove --file="$final_path"
|
|
|
|
ynh_secure_remove --file="$config_path"
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removing nginx web server configuration" --weight=1
|
2019-03-16 02:38:12 +01:00
|
|
|
|
|
|
|
# Remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-03-16 02:38:12 +01:00
|
|
|
# CLOSE A PORT
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-04-04 13:56:40 +02:00
|
|
|
# These ports are no longer open but were in previous versions
|
2019-01-26 14:46:52 +01:00
|
|
|
if yunohost firewall list | grep -q "\- $port$"; then
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Closing port $port" --weight=1
|
2019-03-16 02:38:12 +01:00
|
|
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
2018-12-19 00:02:20 +01:00
|
|
|
fi
|
|
|
|
|
2019-01-26 14:46:52 +01:00
|
|
|
if yunohost firewall list | grep -q "\- $portUnicorn$"; then
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Closing port $portUnicorn" --weight=1
|
2019-03-16 02:38:12 +01:00
|
|
|
ynh_exec_warn_less yunohost firewall disallow TCP $portUnicorn
|
2018-12-19 00:02:20 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
2019-03-16 02:38:12 +01:00
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE GITLAB FILES
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-05-09 01:13:48 +02:00
|
|
|
ynh_secure_remove --file="/var/opt/$app"
|
2019-03-16 02:38:12 +01:00
|
|
|
|
|
|
|
# Remove the log files
|
2019-05-09 01:13:48 +02:00
|
|
|
ynh_secure_remove --file="/var/log/$app"
|
2018-12-19 00:02:20 +01:00
|
|
|
|
2019-05-06 21:17:27 +02:00
|
|
|
# Remove swap
|
|
|
|
|
|
|
|
ynh_del_swap
|
|
|
|
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
2019-03-16 02:38:12 +01:00
|
|
|
# END OF SCRIPT
|
2018-12-19 00:02:20 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-05-09 09:03:19 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|