1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bozon_ynh.git synced 2024-09-03 18:16:09 +02:00
bozon_ynh/scripts/restore
2016-04-05 20:03:26 +02:00

30 lines
867 B
Bash

#! /bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# definie useful vars
app=bozon
parent_path=/var/www
final_path=$parent_path/$app
data_path=/home/yunohost.app/$app
# retrieve arguments
save_path=$1
domain=$(sudo yunohost app setting $app domain)
# restore sources & data
sudo mv $save_path/www/. $final_path/
sudo mv $save_path/datas/. $data_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: $data_path/uploads
sudo chown -R www-data: $data_path/thumbs
# restore Nginx and YunoHost parameters
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