2017-10-06 15:36:42 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2018-09-27 23:33:34 +02:00
|
|
|
|
2017-10-06 15:36:42 +02:00
|
|
|
source _common.sh
|
2022-02-27 16:11:02 +01:00
|
|
|
source ynh_redis
|
|
|
|
source ynh_uwsgi_service__2
|
2017-10-06 15:36:42 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
2017-10-06 15:36:42 +02:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
|
|
db_user=$db_name
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
2018-05-20 23:57:36 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2022-02-27 16:11:02 +01:00
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_authorized_keys_worker >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_authorized_keys_worker service integration..."
|
|
|
|
yunohost service remove ${app}_authorized_keys_worker
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_ci >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_ci service integration..."
|
|
|
|
yunohost service remove ${app}_ci
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_ev_server >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_ev_server service integration..."
|
|
|
|
yunohost service remove ${app}_ev_server
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_gitolite_worker >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_gitolite_worker service integration..."
|
|
|
|
yunohost service remove ${app}_gitolite_worker
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_loadjson >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_loadjson service integration..."
|
|
|
|
yunohost service remove ${app}_loadjson
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_logcom >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_logcom service integration..."
|
|
|
|
yunohost service remove ${app}_logcom
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_milters >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_milters service integration..."
|
|
|
|
yunohost service remove ${app}_milters
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_mirror >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_mirror service integration..."
|
|
|
|
yunohost service remove ${app}_mirror
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_webhook >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_webhook service integration..."
|
|
|
|
yunohost service remove ${app}_webhook
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status ${app}_worker >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing ${app}_worker service integration..."
|
|
|
|
yunohost service remove ${app}_worker
|
|
|
|
fi
|
|
|
|
|
2018-05-20 23:57:36 +02:00
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
2018-05-20 23:57:36 +02:00
|
|
|
|
|
|
|
# Remove the dedicated systemd config
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_remove_systemd_config --service="${app}_authorized_keys_worker"
|
|
|
|
ynh_remove_systemd_config --service="${app}_ci"
|
|
|
|
#ynh_remove_systemd_config --service="${app}_ev_server"
|
|
|
|
ynh_remove_systemd_config --service="${app}_gitolite_worker"
|
|
|
|
ynh_remove_systemd_config --service="${app}_loadjson"
|
|
|
|
ynh_remove_systemd_config --service="${app}_logcom"
|
|
|
|
#ynh_remove_systemd_config --service="${app}_milters"
|
|
|
|
ynh_remove_systemd_config --service="${app}_mirror"
|
|
|
|
ynh_remove_systemd_config --service="${app}_webhook"
|
|
|
|
ynh_remove_systemd_config --service="${app}_worker"
|
|
|
|
|
|
|
|
ynh_remove_uwsgi_service --service="$app"
|
2017-10-06 15:36:42 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
# REMOVE THE POSTGRESQL DATABASE
|
2017-10-06 15:36:42 +02:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing the PostgreSQL database..."
|
2017-10-06 15:36:42 +02:00
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
# Remove a database if it exists, along with the associated user
|
|
|
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
2017-11-23 22:56:00 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
# REMOVE APP MAIN DIR
|
2017-11-23 22:56:00 +01:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing app main directory..."
|
2017-11-23 22:56:00 +01:00
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove --file="$final_path"
|
2017-10-06 15:36:42 +02:00
|
|
|
|
2018-05-20 23:57:36 +02:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
# REMOVE NGINX CONFIGURATION
|
2018-05-20 23:57:36 +02:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
2018-05-20 23:57:36 +02:00
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
# Remove the dedicated NGINX config
|
|
|
|
ynh_remove_nginx_config
|
2018-05-20 23:57:36 +02:00
|
|
|
|
2017-10-06 15:36:42 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing dependencies..."
|
2017-10-06 15:36:42 +02:00
|
|
|
|
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
# SPECIFIC REMOVE
|
2017-10-06 15:36:42 +02:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
# REMOVE THE REDIS DATABASE
|
2017-10-06 15:36:42 +02:00
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing the redis database..."
|
2017-10-06 15:36:42 +02:00
|
|
|
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_redis_remove_db "$redis_db"
|
2017-10-06 15:36:42 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
2017-10-06 15:36:42 +02:00
|
|
|
|
|
|
|
# Delete a system user
|
2022-02-27 16:11:02 +01:00
|
|
|
ynh_system_user_delete --username=$app
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Removal of $app completed"
|