#!/bin/bash # Set variables 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 app_host=$(sudo yunohost app setting $app_id host) app_domain=$(sudo yunohost app setting $app_id domain) # Remove files if localhost installation if [[ $app_host == "127.0.0.1" ]]; 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 data sudo rm -rf $app_data_dir sudo rm -rf $app_logs_dir # 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 # Reload Nginx and update Yunohost sudo service nginx reload sudo yunohost service remove $app_id