seafile_ynh/scripts/remove

32 lines
1,015 B
Text
Raw Normal View History

#!/bin/bash
# Import common cmd
source ./_common.sh
2017-01-05 23:24:32 +01:00
# Init script
init_script
2017-01-05 23:24:32 +01:00
sudo service seafile-server stop || true
# remove sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent
2017-01-05 23:24:32 +01:00
test -e /var/www/$app/remove_sso_conf.py && sudo python /var/www/$app/remove_sso_conf.py
test -e /opt/yunohost/$app/remove_sso_conf.py && sudo python /opt/yunohost/$app/remove_sso_conf.py
sudo rm -rf /var/www/$app
sudo rm -rf /opt/yunohost/$app
sudo rm -f /etc/init.d/seafile-server
sudo rm -rf /home/yunohost.app/seafile-data
2017-01-05 23:24:32 +01:00
sudo rm -rf /tmp/seahub_cache
# Remove databases
2017-01-05 23:24:32 +01:00
root_pwd=$(sudo cat /etc/yunohost/mysql)
mysql -u root -p$root_pwd -e "DROP DATABASE ccnetdb ; DROP DATABASE seafiledb ; DROP DATABASE seahubdb ; DROP USER seafile@localhost ;" || true
# Remove domain config
domain=$(ynh_app_setting_get seafile domain)
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
sudo yunohost service remove seafile-server
# Restart services
sudo service nginx reload
sudo yunohost app ssowatconf