mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
110 lines
3.7 KiB
Bash
110 lines
3.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
port=$(ynh_app_setting_get --app="$app" --key=web_port)
|
|
portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port)
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
config_path=$(ynh_app_setting_get --app=$app --key=config_path)
|
|
|
|
#=================================================
|
|
# STANDARD REMOVE
|
|
#=================================================
|
|
# REMOVE SERVICE FROM ADMIN PANEL
|
|
#=================================================
|
|
|
|
if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1
|
|
then
|
|
ynh_script_progression --message="Removing $app service" --weight=1
|
|
yunohost service remove "gitlab-runsvdir"
|
|
fi
|
|
|
|
#=================================================
|
|
# STOP GITLAB
|
|
#=================================================
|
|
ynh_script_progression --message="Stopping gitlab" --weight=8
|
|
|
|
# I use gitlab-ctl and not ynh_systemd_action or systemctl to stop the service to avoid this error: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/common_installation_problems/README.md#reconfigure-freezes-at-ruby_blocksupervise_redis_sleep-action-run during the reinstall of the app
|
|
gitlab-ctl stop
|
|
|
|
#=================================================
|
|
# REMOVE GITLAB
|
|
#=================================================
|
|
ynh_script_progression --message="Removing Gitlab" --weight=4
|
|
|
|
dpkg --remove gitlab-ce
|
|
|
|
#=================================================
|
|
# REMOVE DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Removing dependencies" --weight=3
|
|
|
|
# Remove metapackage and its dependencies
|
|
ynh_remove_app_dependencies
|
|
|
|
#=================================================
|
|
# REMOVE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression --message="Removing app main directory" --weight=1
|
|
|
|
# Remove the app directory securely
|
|
ynh_secure_remove --file="$final_path"
|
|
ynh_secure_remove --file="$config_path"
|
|
|
|
#=================================================
|
|
# REMOVE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Removing nginx web server configuration" --weight=1
|
|
|
|
# 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_script_progression --message="Closing port $port" --weight=1
|
|
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
fi
|
|
|
|
if yunohost firewall list | grep -q "\- $portPuma$"; then
|
|
ynh_script_progression --message="Closing port $portPuma" --weight=1
|
|
ynh_exec_warn_less yunohost firewall disallow TCP $portPuma
|
|
fi
|
|
|
|
#=================================================
|
|
# SPECIFIC REMOVE
|
|
#=================================================
|
|
# REMOVE GITLAB FILES
|
|
#=================================================
|
|
|
|
ynh_secure_remove --file="/var/opt/$app"
|
|
|
|
# Remove the log files
|
|
ynh_secure_remove --file="/var/log/$app"
|
|
|
|
# Remove swap
|
|
|
|
ynh_del_swap
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|