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

114 lines
3.8 KiB
Text
Raw Normal View History

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
port=$(ynh_app_setting_get --app="$app" --key=web_port)
2020-05-23 01:04:34 +02:00
portPuma=$(ynh_app_setting_get --app="$app" --key=puma_port)
2019-05-09 01:13:48 +02:00
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
2020-06-04 13:37:12 +02:00
# Used by ynh_remove_nginx_config
domain=$(ynh_app_setting_get --app="$app" --key=domain)
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
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 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
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
#=================================================
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
#=================================================
2019-05-09 09:03:19 +02:00
ynh_script_progression --message="Removal of $app completed" --last