1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00
gitlab_ynh/scripts/remove
2019-05-06 21:17:27 +02:00

110 lines
3.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain)
port=$(ynh_app_setting_get "$app" web_port)
portUnicorn=$(ynh_app_setting_get "$app" unicorn_port)
final_path=$(ynh_app_setting_get $app final_path)
config_path=$(ynh_app_setting_get $app config_path)
#=================================================
# STANDARD REMOVE
#=================================================
# 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
#=================================================
# STOP GITLAB
#=================================================
ynh_print_info "Stopping gitlab"
gitlab-ctl stop
#=================================================
# REMOVE GITLAB
#=================================================
ynh_print_info "Removing Gitlab"
dpkg --remove gitlab-ce
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Removing app main directory"
# Remove the app directory securely
ynh_secure_remove "$final_path"
ynh_secure_remove "$config_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
# These ports are no longer open but were in previous versions
if yunohost firewall list | grep -q "\- $port$"; then
ynh_print_info "Closing port $port"
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $portUnicorn$"; then
ynh_print_info "Closing port $portUnicorn"
ynh_exec_warn_less yunohost firewall disallow TCP $portUnicorn
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE GITLAB FILES
#=================================================
ynh_secure_remove "/var/opt/$app"
# Remove the log files
ynh_secure_remove "/var/log/$app"
# Remove swap
ynh_del_swap
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"