mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Working on remove script
This commit is contained in:
parent
7bec933db8
commit
d27851a952
3 changed files with 82 additions and 20 deletions
|
@ -59,7 +59,7 @@
|
||||||
"en": "Is it a public application?",
|
"en": "Is it a public application?",
|
||||||
"fr": "Est-ce une application publique ?"
|
"fr": "Est-ce une application publique ?"
|
||||||
},
|
},
|
||||||
"default": true
|
"default": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "language",
|
"name": "language",
|
||||||
|
|
|
@ -15,8 +15,9 @@ readonly APP_INSTALL_PATH="/var/www/wekan"
|
||||||
readonly SYSTEMD_CONF_TEMPLATE="$PWD/../conf/systemd.conf"
|
readonly SYSTEMD_CONF_TEMPLATE="$PWD/../conf/systemd.conf"
|
||||||
readonly NGINX_CONF_TEMPLATE="$PWD/../conf/nginx.conf"
|
readonly NGINX_CONF_TEMPLATE="$PWD/../conf/nginx.conf"
|
||||||
|
|
||||||
export NVM_INSTALL_DIR="/opt/nvm"
|
readonly METEOR_INSTALL_DIR="/opt/meteor"
|
||||||
NVM_BIN="/opt/nvm"
|
readonly NVM_INSTALL_DIR="/opt/nvm"
|
||||||
|
readonly METEOR_BIN="/usr/local/bin/meteor"
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -39,8 +40,6 @@ function create_user_wekan()
|
||||||
then
|
then
|
||||||
sudo useradd wekan
|
sudo useradd wekan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_node()
|
function install_node()
|
||||||
|
@ -84,7 +83,6 @@ function add_swap_if_needed()
|
||||||
function install_meteor()
|
function install_meteor()
|
||||||
{
|
{
|
||||||
# Install meteor
|
# Install meteor
|
||||||
METEOR_INSTALL_DIR="/opt/meteor"
|
|
||||||
if [ ! -d "$METEOR_INSTALL_DIR" ];
|
if [ ! -d "$METEOR_INSTALL_DIR" ];
|
||||||
then
|
then
|
||||||
sudo mkdir $METEOR_INSTALL_DIR
|
sudo mkdir $METEOR_INSTALL_DIR
|
||||||
|
@ -98,7 +96,7 @@ function install_and_build_wekan()
|
||||||
{
|
{
|
||||||
local npm_bin=`sudo su -c ". $NVM_INSTALL_DIR/nvm.sh && nvm use 0.10 >/dev/null && which npm"`
|
local npm_bin=`sudo su -c ". $NVM_INSTALL_DIR/nvm.sh && nvm use 0.10 >/dev/null && which npm"`
|
||||||
|
|
||||||
# Clone wekan github repo
|
# Give all permissions to app dir to user wekan
|
||||||
if [ -d "$APP_INSTALL_PATH" ];
|
if [ -d "$APP_INSTALL_PATH" ];
|
||||||
then
|
then
|
||||||
sudo rm -rf $APP_INSTALL_PATH
|
sudo rm -rf $APP_INSTALL_PATH
|
||||||
|
@ -106,16 +104,15 @@ function install_and_build_wekan()
|
||||||
sudo mkdir -p $APP_INSTALL_PATH
|
sudo mkdir -p $APP_INSTALL_PATH
|
||||||
sudo chown -R wekan $APP_INSTALL_PATH
|
sudo chown -R wekan $APP_INSTALL_PATH
|
||||||
cd $APP_INSTALL_PATH
|
cd $APP_INSTALL_PATH
|
||||||
sudo su wekan -c "git clone https://github.com/wekan/wekan.git ."
|
|
||||||
|
|
||||||
# Give all permissions to wekan (it's the user we'll use to build :/)
|
# Clone wekan github repo
|
||||||
|
sudo su wekan -c "git clone https://github.com/wekan/wekan.git ."
|
||||||
|
|
||||||
# Install dependencies with npm
|
# Install dependencies with npm
|
||||||
sudo su wekan -c "$npm_bin install"
|
sudo su wekan -c "$npm_bin install"
|
||||||
|
|
||||||
# Build with meteor
|
# Build with meteor
|
||||||
sudo rm -rf .build
|
sudo rm -rf .build
|
||||||
METEOR_BIN="/usr/local/bin/meteor"
|
|
||||||
sudo su wekan -c "$METEOR_BIN build .build --directory | tee /tmp/meteor_build.log"
|
sudo su wekan -c "$METEOR_BIN build .build --directory | tee /tmp/meteor_build.log"
|
||||||
|
|
||||||
# Install dependencies .. again ?
|
# Install dependencies .. again ?
|
||||||
|
|
|
@ -1,19 +1,84 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# See comments in install script
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
readonly APP=$YNH_APP_INSTANCE_NAME
|
||||||
|
readonly DOMAIN=$(ynh_app_setting_get "$app" domain)
|
||||||
|
|
||||||
# Remove sources
|
readonly APP_INSTALL_PATH="/var/www/wekan"
|
||||||
sudo rm -rf /var/www/$app
|
readonly NVM_INSTALL_DIR="/opt/nvm"
|
||||||
|
readonly METEOR_INSTALL_DIR="/opt/meteor"
|
||||||
|
|
||||||
# Remove nginx configuration file
|
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
|
|
||||||
# Reload nginx service
|
function remove_user_wekan()
|
||||||
sudo service nginx reload
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
sudo service nginx reload
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_user_wekan
|
||||||
|
remove_node
|
||||||
|
remove_meteor
|
||||||
|
remove_wekan
|
||||||
|
remove_mongodb
|
||||||
|
remove_systemd_service
|
||||||
|
remove_nginx_conf
|
||||||
|
|
Loading…
Add table
Reference in a new issue