2016-03-23 19:30:43 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
2016-04-04 22:35:43 +02:00
|
|
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
|
|
|
set -e
|
|
|
|
|
2016-04-04 20:01:54 +02:00
|
|
|
# definie useful vars
|
2016-03-23 19:30:43 +01:00
|
|
|
app=bozon
|
2016-04-04 20:01:54 +02:00
|
|
|
parent_path=/var/www
|
|
|
|
final_path=$parent_path/$app
|
|
|
|
|
|
|
|
#retrieve arguments
|
2016-03-23 19:30:43 +01:00
|
|
|
save_path=$1
|
2016-04-04 20:01:54 +02:00
|
|
|
domain=$(sudo yunohost app setting $app domain)
|
|
|
|
|
|
|
|
# move the backup
|
|
|
|
sudo mv $save_path/$app $final_path
|
|
|
|
|
|
|
|
# restore permissions
|
|
|
|
sudo chown -R root: $final_path
|
|
|
|
sudo find $final_path -type f | xargs sudo chmod 644
|
|
|
|
sudo find $final_path -type d | xargs sudo chmod 755
|
|
|
|
sudo chown -R www-data: $final_path/private
|
|
|
|
sudo chown -R www-data: $final_path/uploads
|
|
|
|
sudo chown -R www-data: $final_path/thumbs
|
2016-03-23 19:30:43 +01:00
|
|
|
|
2016-04-04 20:01:54 +02:00
|
|
|
sudo cp -a $save_path/yunohost /etc/yunohost/apps/$app/.
|
|
|
|
sudo cp -a $save_path/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|