2017-10-06 11:02:02 +02:00
|
|
|
#!/bin/bash
|
2015-02-17 03:39:33 +01:00
|
|
|
|
2017-10-06 11:02:02 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
2022-05-29 12:45:09 +02:00
|
|
|
source ynh_install_ruby__2
|
2017-10-06 11:02:02 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
2017-10-06 11:02:02 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2022-05-29 12:45:09 +02: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)
|
2017-10-06 11:02:02 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
2022-05-29 12:45:09 +02: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.target >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing $app.target service integration..."
|
|
|
|
yunohost service remove $app.target
|
|
|
|
fi
|
|
|
|
|
2017-10-06 11:02:02 +02:00
|
|
|
#=================================================
|
|
|
|
# STOP AND REMOVE SERVICE
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
|
|
|
|
|
|
|
systemctl stop ${app}.target
|
|
|
|
systemctl disable ${app}.target --quiet
|
|
|
|
ynh_remove_systemd_config --service="$app_web"
|
|
|
|
ynh_remove_systemd_config --service="$app_sidekiq"
|
2019-12-02 21:01:24 +01:00
|
|
|
ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf"
|
|
|
|
ynh_secure_remove --file="/etc/systemd/system/${app}.target"
|
2019-12-12 23:49:44 +01:00
|
|
|
ynh_secure_remove --file="/run/${app}"
|
2019-12-02 21:01:24 +01:00
|
|
|
systemctl daemon-reload
|
2017-10-06 11:02:02 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# REMOVE THE POSTGRESQL DATABASE
|
2017-10-06 11:02:02 +02:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Removing the PostgreSQL database..."
|
2017-10-06 11:02:02 +02:00
|
|
|
|
2022-05-29 12:45:09 +02: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-10-06 11:02:02 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# REMOVE APP MAIN DIR
|
2017-10-06 10:59:36 +02:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Removing app main directory..."
|
2015-02-17 03:39:33 +01:00
|
|
|
|
2022-05-29 12:45:09 +02:00
|
|
|
# Remove the app directory securely
|
|
|
|
ynh_secure_remove --file="$final_path"
|
2015-02-17 03:39:33 +01:00
|
|
|
|
2017-10-06 11:02:02 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
2017-10-06 11:02:02 +02:00
|
|
|
|
2022-05-29 12:45:09 +02:00
|
|
|
# Remove the dedicated NGINX config
|
2017-10-06 11:02:02 +02:00
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# REMOVE DEPENDENCIES
|
2017-10-06 11:02:02 +02:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=10
|
2019-12-02 21:01:24 +01:00
|
|
|
|
2022-05-29 12:45:09 +02:00
|
|
|
# Remove metapackage and its dependencies
|
2020-07-05 19:13:50 +02:00
|
|
|
ynh_remove_ruby
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_remove_nodejs
|
|
|
|
ynh_remove_app_dependencies
|
2020-07-05 19:13:50 +02:00
|
|
|
|
2022-03-02 09:12:56 +01:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# GENERIC FINALIZATION
|
2022-03-02 09:12:56 +01:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# REMOVE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing the dedicated system user..."
|
|
|
|
|
|
|
|
# Delete a system user
|
|
|
|
ynh_system_user_delete --username=$app
|
2022-03-02 09:12:56 +01:00
|
|
|
|
2019-12-02 21:01:24 +01:00
|
|
|
#=================================================
|
2022-05-29 12:45:09 +02:00
|
|
|
# END OF SCRIPT
|
2019-12-02 21:01:24 +01:00
|
|
|
#=================================================
|
|
|
|
|
2022-05-29 12:45:09 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed"
|