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
# 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
#=================================================
2020-12-23 17:08:21 +01:00
ynh_script_progression --message="Stopping GitLab" --weight=8
2019-01-26 14:30:58 +01:00
2019-05-13 00:25:03 +02:00
# 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
2019-02-01 23:24:57 +01:00
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
#=================================================
2020-12-23 17:08:21 +01: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 APP MAIN DIR
#=================================================
2019-03-16 02:38:12 +01:00
# Remove the app directory securely
2023-03-03 11:24:16 +01:00
config_path=/etc/$app
2019-05-09 01:13:48 +02:00
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
#=================================================
2020-12-23 17:08:21 +01:00
ynh_script_progression --message="Removing NGINX web server configuration" --weight=1
2019-03-16 02:38:12 +01:00
2020-12-23 17:08:21 +01:00
# Remove the dedicated NGINX config
2019-03-16 02:38:12 +01:00
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
2020-05-23 01:04:34 +02:00
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
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
#=================================================
2020-12-23 17:18:58 +01:00
ynh_script_progression --message="Removal of GitLab completed" --last