From 04bc67a2c80bbd703e6be7970f72f2cb7aa92d7a Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 6 Feb 2015 18:42:21 +0000 Subject: [PATCH] Update on main scripts --- manifest.json | 11 ++++++++++- scripts/backup | 17 ----------------- scripts/install | 30 ++++++++++++++++++++++-------- scripts/remove | 10 ++++++---- scripts/restore | 18 ------------------ 5 files changed, 38 insertions(+), 48 deletions(-) delete mode 100644 scripts/backup delete mode 100644 scripts/restore diff --git a/manifest.json b/manifest.json index 6b91c0d..cf7b14b 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,16 @@ }, "example": "/rainloop", "default": "/rainloop" - } + }, + { + "name": "is_public", + "ask": { + "en": "Is it a public application ?", + "fr": "Est-ce une page publique ?" + }, + "choices": ["Yes", "No"], + "default": "Yes" + } ] } } diff --git a/scripts/backup b/scripts/backup deleted file mode 100644 index c47aa2a..0000000 --- a/scripts/backup +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# The parameter $1 is the backup directory location -# which will be compressed afterward -backup_dir=$1/apps/rainloop -mkdir -p $backup_dir - -sudo cp -a /var/www/rainloop/. $backup_dir/sources -sudo cp -a /etc/php5/fpm/pool.d/rainloop.conf $backup_dir/php-fpm.conf - -db_pwd=$(sudo yunohost app setting rainloop mysqlpwd) -sudo mysqldump -u rainloop -p"$db_pwd" rainloop > $backup_dir/dump.sql - -# Copy Nginx and YunoHost parameters to make the script "standalone" -sudo cp -a /etc/yunohost/apps/rainloop/. $backup_dir/yunohost -domain=$(sudo yunohost app setting rainloop domain) -sudo cp -a /etc/nginx/conf.d/$domain.d/rainloop.conf $backup_dir/nginx.conf diff --git a/scripts/install b/scripts/install index 3643eb3..2d0fcb1 100644 --- a/scripts/install +++ b/scripts/install @@ -1,8 +1,13 @@ #!/bin/bash +app=rainloop + # Retrieve arguments domain=$1 path=$2 +is_public=$3 + + # Check domain/path availability sudo yunohost app checkurl $domain$path -a rainloop @@ -11,20 +16,21 @@ if [[ ! $? -eq 0 ]]; then fi # Generate random DES key & password -deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') -db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') +#deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') +"db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p') # Use 'rainloop' as database name and user -db_user=rainloop +#db_user=rainloop # Initialize database and store mysql password for upgrade -sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/SQL/mysql.initial.sql) -sudo yunohost app setting rainloop mysqlpwd -v $db_pwd +#sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../sources/SQL/mysql.initial.sql) +#sudo yunohost app setting rainloop mysqlpwd -v $db_pwd -mysql -u $db_user -p$db_pwd $db_user < ../sources/plugins/automatic_addressbook/SQL/mysql.initial.sql +#mysql -u $db_user -p$db_pwd $db_user < ../sources/plugins/automatic_addressbook/SQL/mysql.initial.sql # Copy files to the right place -final_path=/var/www/rainloop +final_path=/var/www/$app +sudo rm -rf $final_path sudo mkdir -p $final_path sudo cp -a ../sources/* $final_path @@ -44,7 +50,15 @@ sudo cp ../conf/php-fpm.conf $finalphpconf sudo chown root: $finalphpconf sudo chmod 644 $finalphpconf +# Make app public if necessary +sudo yunohost app setting my_webapp is_public -v "$is_public" +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting my_webapp skipped_uris -v "/" +fi + + # Reload Nginx and regenerate SSOwat conf -sudo service php5-fpm restart +sudo service php5-fpm reload sudo service nginx reload sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove index cf7ff4d..ffe58d3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,14 +1,16 @@ #!/bin/bash -db_user=rainloop -db_name=rainloop -root_pwd=$(sudo cat /etc/yunohost/mysql) +#db_user=rainloop +#db_name=rainloop +#root_pwd=$(sudo cat /etc/yunohost/mysql) domain=$(sudo yunohost app setting rainloop domain) -mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" +#mysql -u root -p $root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;" sudo rm -rf /var/www/rainloop sudo rm -f /etc/nginx/conf.d/$domain.d/rainloop.conf sudo rm -f /etc/php5/fpm/pool.d/rainloop.conf sudo service php5-fpm restart sudo service nginx reload +sudo yunohost app ssowatconf + diff --git a/scripts/restore b/scripts/restore deleted file mode 100644 index 1ce01d7..0000000 --- a/scripts/restore +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# The parameter $1 is the uncompressed restore directory location -backup_dir=$1/apps/rainloop - -sudo cp -a $backup_dir/sources/. /var/www/rainloop -sudo cp -a $backup_dir/php-fpm.conf /etc/php5/fpm/pool.d/rainloop.conf - -db_pwd=$(sudo yunohost app setting rainloop mysqlpwd) -sudo yunohost app initdb rainloop -p "$db_pwd" -s $backup_dir/dump.sql - -# Copy Nginx and YunoHost parameters to make the script "standalone" -sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/rainloop -domain=$(sudo yunohost app setting rainloop domain) -sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/rainloop.conf - -sudo service php5-fpm restart -sudo service nginx restart