1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/headphones_ynh.git synced 2024-09-03 19:26:02 +02:00
headphones_ynh/scripts/remove
2015-09-05 17:52:58 +02:00

56 lines
No EOL
1.2 KiB
Bash

#!/bin/bash
# Common variable declaration
app_id=headphones
app_user=headphones
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
# Remove files if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
# Kill app and remove from boot
sudo service $app_id stop
sudo killall $app_id
sudo update-rc.d $app_id remove
# Delete app user
sudo deluser $app_user
# Remove sources
sudo rm -rf $app_install_dir
# Remove logs
if [[ $app_logs_dir != "$app_data_dir"* ]]; then
sudo rm -rf $app_logs_dir
fi
# Remove data
if [[ $keep_data == "No" ]]; then
sudo rm -rf $app_data_dir
fi
# 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
# Remove Yunohost service
sudo yunohost service remove $app_id
# Reload Nginx and update Yunohost
sudo service nginx reload
sudo yunohost app ssowatconf