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

upgrade script with database backup

This commit is contained in:
aquaxp 2014-03-21 20:59:06 +07:00
parent bd141ffc1a
commit b98c767cc0
4 changed files with 51 additions and 9 deletions

View file

@ -2,4 +2,4 @@ TODO
----
Adding LDAP usernames
Auto setup admin account and other system defined things.
Auto setup admin account and other system defined things.

View file

@ -30,6 +30,7 @@ sudo chmod 755 $final_path/Specific/db/db.sqlite
sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/baikal.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/baikal.conf
# Change variables in Baikal sources for correct work in subpathes
sudo sed -i "s@PROJECT_BASEURI_@\"$path/\"@g" $final_path/Core/Frameworks/Baikal/Model/Config/System.php
# Reload Nginx and regenerate SSOwat conf
@ -37,8 +38,3 @@ sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app setting baikal skipped_uris -v "/"
sudo yunohost app ssowatconf
# Unprotect URIs
#sudo yunohost app setting owncloud skipped_uris -v "/public.php,/core,/apps/files,/index.php/apps/files"
#sudo yunohost app setting owncloud unprotected_uris -v "/remote.php,/cron.php,/status.php"
#sudo yunohost app ssowatconf

View file

@ -1,8 +1,16 @@
#!/bin/bash
# Backuping db
backup_path=/var/cache/yunohost/backups/baikal
final_path=/var/www/baikal/
mkdir -p $backup_path
sudo cp -a $final_path/Specific/* $backup_path
# Removing executable files
sudo rm -rf /var/www/baiakl
sudo rm -f /etc/nginx/conf.d/$domain.d/baikal.conf
# Restarting services
sudo service php5-fpm restart
sudo service nginx reload
sudo service nginx reload

View file

@ -1,3 +1,41 @@
#!/bin/bash
#nothing to do
# Retrieve arguments
domain=$(sudo yunohost app setting owncloud domain)
path=$(sudo yunohost app setting owncloud path)
# Remove trailing "/" for next commands
path=${path%/}
# Backuping db
backup_path=/var/cache/yunohost/backups/baikal
final_path=/var/www/baikal/
mkdir -p $backup_path
sudo cp -a $final_path/Specific/* $backup_path
# Copy files to the right place
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/baikal.conf
sudo chown -R www-data:www-data $final_path
sudo find $final_path -type d -exec chmod 755 {} \;
sudo touch $final_path/Specific/ENABLE_INSTALL
#sudo chmod 755 $final_path/Specific
#sudo chmod 755 $final_path/Specific/db
#sudo chmod 755 $final_path/Specific/db/db.sqlite
# Change variables in Baikal configuration
sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/baikal.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/baikal.conf
sudo sed -i "s@PROJECT_BASEURI_@\"$path/\"@g" $final_path/Core/Frameworks/Baikal/Model/Config/System.php
# Restoring backup
sudo cp -a $backup_path/* $final_path/Specific
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app setting baikal skipped_uris -v "/"
sudo yunohost app ssowatconf