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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Loading installation settings..."
|
2018-12-19 00:02:20 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2019-03-16 02:38:12 +01:00
|
|
|
|
2018-12-19 00:48:27 +01:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2018-12-19 00:02:20 +01:00
|
|
|
port=$(ynh_app_setting_get "$app" web_port)
|
|
|
|
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
|
2019-03-16 02:38:12 +01:00
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
|
|
config_path=$(ynh_app_setting_get $app 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
|
|
|
|
ynh_print_info "Removing $app service"
|
|
|
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Stopping gitlab"
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Removing Gitlab"
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Removing dependencies"
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Removing app main directory"
|
2018-12-19 00:02:20 +01:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
# Remove the app directory securely
|
2018-12-19 00:02:20 +01:00
|
|
|
ynh_secure_remove "$final_path"
|
|
|
|
ynh_secure_remove "$config_path"
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2019-03-16 02:38:12 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info "Removing nginx web server configuration"
|
|
|
|
|
|
|
|
# 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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Closing port $port"
|
|
|
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Closing port $portUnicorn"
|
|
|
|
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-03-16 02:38:12 +01:00
|
|
|
ynh_secure_remove "/var/opt/$app"
|
|
|
|
|
|
|
|
# Remove the log files
|
2019-03-24 21:50:03 +01:00
|
|
|
ynh_secure_remove "/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-03-16 02:38:12 +01:00
|
|
|
ynh_print_info "Removal of $app completed"
|