1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mastodon_ynh.git synced 2024-09-03 19:46:02 +02:00
mastodon_ynh/scripts/remove
2018-06-21 08:18:02 +05:30

106 lines
3 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh # Loads the generic functions usually used in the script
# Source app helpers
source /usr/share/yunohost/helpers
source _future.sh
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
db_name=$(ynh_app_setting_get "$app" db_name)
final_path=$(ynh_app_setting_get "$app" final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_remove_systemd_config "$app-web"
ynh_remove_systemd_config "$app-sidekiq"
ynh_remove_systemd_config "$app-streaming"
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#==============================================
if yunohost service status | grep -q "$app-web"
then
echo "Remove $app-web service"
yunohost service remove "$app-web"
fi
if yunohost service status | grep -q "$app-sidekiq"
then
echo "Remove $app-sidekiq service"
yunohost service remove "$app-sidekiq"
fi
if yunohost service status | grep -q "$app-streaming"
then
echo "Remove $app-streaming service"
yunohost service remove "$app-streaming"
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_nodejs
#=================================================
# REMOVE THE PostgreSQL DATABASE
#=================================================
# delete postgresql database & user
ynh_psql_remove_db "$db_name" "$app"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
# Remove the app directory securely
ynh_secure_remove "$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
#=================================================
# REMOVE source.list
#=================================================
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
ynh_secure_remove /etc/apt/sources.list.d/backports.list
ynh_secure_remove /etc/apt/sources.list.d/jessie-backports.list
fi
ynh_secure_remove /etc/apt/sources.list.d/yarn.list
# Delete ruby exec
#ynh_secure_remove /usr/bin/ruby
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_system_user_delete $app