2017-02-10 17:06:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Retrieve app settings
|
2017-02-12 03:01:35 +01:00
|
|
|
readonly APP=$YNH_APP_INSTANCE_NAME
|
|
|
|
readonly DOMAIN=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
|
|
|
readonly APP_INSTALL_PATH="/var/www/wekan"
|
|
|
|
readonly NVM_INSTALL_DIR="/opt/nvm"
|
|
|
|
readonly METEOR_INSTALL_DIR="/opt/meteor"
|
|
|
|
|
|
|
|
|
|
|
|
function remove_user_wekan()
|
|
|
|
{
|
|
|
|
if [[ ! -z $(sudo getent passwd wekan) ]]
|
|
|
|
then
|
|
|
|
sudo userdel wekan
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_node()
|
|
|
|
{
|
|
|
|
if [ -d "$NVM_INSTALL_DIR" ];
|
|
|
|
then
|
|
|
|
sudo rm -rf $NVM_INSTALL_DIR
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_meteor()
|
|
|
|
{
|
|
|
|
if [ -d "$METEOR_INSTALL_DIR" ];
|
|
|
|
then
|
|
|
|
sudo rm -rf $METEOR_INSTALL_DIR
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_wekan()
|
|
|
|
{
|
|
|
|
if [ -d "$APP_INSTALL_PATH" ];
|
|
|
|
then
|
|
|
|
sudo rm -rf $APP_INSTALL_PATH
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function remove_mongodb()
|
|
|
|
{
|
|
|
|
sudo systemctl stop mongod
|
|
|
|
sudo systemctl disable mongod
|
|
|
|
|
|
|
|
# TODO / FIXME : remove the keys added ?
|
|
|
|
#sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
|
|
|
|
|
|
|
sudo apt-get remove -y mongodb-org=3.2.11 mongodb-org-server=3.2.11 mongodb-org-shell=3.2.11 mongodb-org-mongos=3.2.11 mongodb-org-tools=3.2.11
|
|
|
|
sudo apt-get update
|
|
|
|
sudo rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list
|
|
|
|
sudo apt-get update
|
|
|
|
}
|
|
|
|
|
|
|
|
function remove_systemd_service()
|
|
|
|
{
|
|
|
|
sudo systemctl stop wekan
|
|
|
|
sudo systemctl disable wekan
|
|
|
|
sudo rm -f /etc/systemd/system/wekan.service
|
|
|
|
sudo systemctl daemon-reload
|
|
|
|
}
|
2017-02-10 17:06:59 +01:00
|
|
|
|
2017-02-12 03:01:35 +01:00
|
|
|
function remove_nginx_conf()
|
|
|
|
{
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
sudo rm -f /etc/nginx/conf.d/$DOMAIN.d/$APP.conf
|
2017-02-10 17:06:59 +01:00
|
|
|
|
2017-02-12 03:01:35 +01:00
|
|
|
sudo service nginx reload
|
|
|
|
}
|
2017-02-10 17:06:59 +01:00
|
|
|
|
2017-02-12 03:01:35 +01:00
|
|
|
remove_user_wekan
|
|
|
|
remove_node
|
|
|
|
remove_meteor
|
|
|
|
remove_wekan
|
|
|
|
remove_mongodb
|
|
|
|
remove_systemd_service
|
|
|
|
remove_nginx_conf
|