2017-02-18 16:45:43 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-12-03 19:24:03 +01:00
|
|
|
#=================================================
|
2020-05-17 09:28:22 +02:00
|
|
|
# GENERIC START
|
2017-12-03 19:24:03 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-05-17 09:28:22 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
2017-02-18 16:45:43 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
|
|
db_user=$db_name
|
2017-03-12 12:40:26 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
#=================================================
|
|
|
|
# STANDARD REMOVE
|
|
|
|
#=================================================
|
|
|
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
|
|
#=================================================
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
|
|
|
if ynh_exec_warn_less yunohost service status grafana-server >/dev/null
|
|
|
|
then
|
|
|
|
ynh_script_progression --message="Removing grafana services..." --weight=1
|
|
|
|
yunohost service remove grafana-server
|
|
|
|
yunohost service remove influxdb
|
|
|
|
fi
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE THE MYSQL DATABASE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing the MySQL database..." --weight=3
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
# Remove a database if it exists, along with the associated user
|
|
|
|
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
2017-03-12 12:40:26 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
#=================================================
|
|
|
|
# REMOVE DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing dependencies..." --weight=26
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
# Remove metapackage and its dependencies
|
|
|
|
ynh_remove_app_dependencies
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# REMOVE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
|
|
|
|
|
|
|
# Remove the dedicated nginx config
|
|
|
|
ynh_remove_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC REMOVE
|
|
|
|
#=================================================
|
2017-08-03 07:38:57 +02:00
|
|
|
|
2017-02-18 16:45:43 +01:00
|
|
|
# If NetData is installed, configure it not to feed InfluxDB any more
|
|
|
|
netdata_conf="/opt/netdata/etc/netdata/netdata.conf"
|
|
|
|
if [[ -f "$netdata_conf" ]] ; then
|
2020-05-17 09:28:22 +02:00
|
|
|
sed -i '/^\[backend\]$/,/^\[/ {
|
2017-02-18 16:45:43 +01:00
|
|
|
s/enabled = yes/# enabled = no/
|
|
|
|
s/type = opentsdb/# type = graphite/
|
|
|
|
s/destination = localhost:4242/# destination = localhost/
|
2019-01-13 18:51:59 +01:00
|
|
|
s/update every = 60/# update every = 10/
|
2017-02-18 16:45:43 +01:00
|
|
|
}' $netdata_conf
|
|
|
|
fi
|
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
ynh_secure_remove --file="/etc/grafana/grafana.ini"
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2017-02-18 16:45:43 +01:00
|
|
|
|
2020-05-17 09:28:22 +02:00
|
|
|
ynh_script_progression --message="Removal of $app completed" --last
|