1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00

Update on main scripts

This commit is contained in:
polytan02 2015-02-06 18:42:21 +00:00
parent 680a8901f8
commit 04bc67a2c8
5 changed files with 38 additions and 48 deletions

View file

@ -31,7 +31,16 @@
}, },
"example": "/rainloop", "example": "/rainloop",
"default": "/rainloop" "default": "/rainloop"
} },
{
"name": "is_public",
"ask": {
"en": "Is it a public application ?",
"fr": "Est-ce une page publique ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
}
] ]
} }
} }

View file

@ -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

View file

@ -1,8 +1,13 @@
#!/bin/bash #!/bin/bash
app=rainloop
# Retrieve arguments # Retrieve arguments
domain=$1 domain=$1
path=$2 path=$2
is_public=$3
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a rainloop sudo yunohost app checkurl $domain$path -a rainloop
@ -11,20 +16,21 @@ if [[ ! $? -eq 0 ]]; then
fi fi
# Generate random DES key & password # 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') #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') "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 # Use 'rainloop' as database name and user
db_user=rainloop #db_user=rainloop
# Initialize database and store mysql password for upgrade # 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 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 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 # 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 mkdir -p $final_path
sudo cp -a ../sources/* $final_path sudo cp -a ../sources/* $final_path
@ -44,7 +50,15 @@ sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf sudo chown root: $finalphpconf
sudo chmod 644 $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 # Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart sudo service php5-fpm reload
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf sudo yunohost app ssowatconf

View file

@ -1,14 +1,16 @@
#!/bin/bash #!/bin/bash
db_user=rainloop #db_user=rainloop
db_name=rainloop #db_name=rainloop
root_pwd=$(sudo cat /etc/yunohost/mysql) #root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting rainloop domain) 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 -rf /var/www/rainloop
sudo rm -f /etc/nginx/conf.d/$domain.d/rainloop.conf sudo rm -f /etc/nginx/conf.d/$domain.d/rainloop.conf
sudo rm -f /etc/php5/fpm/pool.d/rainloop.conf sudo rm -f /etc/php5/fpm/pool.d/rainloop.conf
sudo service php5-fpm restart sudo service php5-fpm restart
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf

View file

@ -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