2015-08-23 17:57:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-09-05 17:52:58 +02:00
|
|
|
# Common variable declaration
|
2015-08-23 17:57:27 +02:00
|
|
|
app_id=headphones
|
|
|
|
app_user=headphones
|
2015-09-05 17:52:58 +02:00
|
|
|
app_install_dir="/opt/yunohost/${app_id}"
|
|
|
|
app_data_dir="/home/yunohost.app/${app_id}"
|
|
|
|
app_logs_dir="/var/log/${app_id}"
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
app_method="$(sudo yunohost app setting ${app_id} method)"
|
|
|
|
app_domain="$(sudo yunohost app setting ${app_id} domain)"
|
|
|
|
keep_data=$1
|
2015-08-23 17:57:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Remove files if localhost installation
|
2015-09-05 17:52:58 +02:00
|
|
|
if [[ $app_method == "LOCAL"* ]]; then
|
2015-08-23 17:57:27 +02:00
|
|
|
|
2015-09-05 17:52:58 +02:00
|
|
|
# Kill app and remove from boot
|
2015-08-23 17:57:27 +02:00
|
|
|
sudo service $app_id stop
|
|
|
|
sudo killall $app_id
|
|
|
|
sudo update-rc.d $app_id remove
|
|
|
|
|
2015-09-05 17:52:58 +02:00
|
|
|
# Delete app user
|
2015-08-23 17:57:27 +02:00
|
|
|
sudo deluser $app_user
|
|
|
|
|
|
|
|
# Remove sources
|
|
|
|
sudo rm -rf $app_install_dir
|
|
|
|
|
2015-09-05 17:52:58 +02:00
|
|
|
# Remove logs
|
|
|
|
if [[ $app_logs_dir != "$app_data_dir"* ]]; then
|
|
|
|
sudo rm -rf $app_logs_dir
|
|
|
|
fi
|
|
|
|
|
2015-08-23 17:57:27 +02:00
|
|
|
# Remove data
|
2015-09-05 17:52:58 +02:00
|
|
|
if [[ $keep_data == "No" ]]; then
|
|
|
|
sudo rm -rf $app_data_dir
|
|
|
|
fi
|
2015-08-23 17:57:27 +02:00
|
|
|
|
|
|
|
# Remove daemon config
|
|
|
|
sudo rm -f /etc/init.d/$app_id
|
|
|
|
sudo rm -f /etc/default/$app_id
|
|
|
|
sudo rm -rf /var/run/$app_id
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Remove Nginx parameters
|
|
|
|
sudo rm -f /etc/nginx/conf.d/$app_domain.d/$app_id.conf
|
|
|
|
|
2015-09-05 17:52:58 +02:00
|
|
|
# Remove Yunohost service
|
|
|
|
sudo yunohost service remove $app_id
|
|
|
|
|
2015-08-23 17:57:27 +02:00
|
|
|
# Reload Nginx and update Yunohost
|
|
|
|
sudo service nginx reload
|
2015-09-05 17:52:58 +02:00
|
|
|
sudo yunohost app ssowatconf
|