1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00

[enh] Use latest backup specification.

Conflicts:
	scripts/backup
	scripts/restore
This commit is contained in:
opi 2016-05-07 01:44:03 +02:00
parent f49eabebc3
commit 43db84f4ad
2 changed files with 27 additions and 17 deletions

View file

@ -1,15 +1,19 @@
#!/bin/bash
app=jappix
# The parameter $1 is the backup directory location
# which will be compressed afterward
backup_dir=$1/apps/$app
mkdir -p $backup_dir
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Backup sources & data
sudo cp -a /var/www/$app/. $backup_dir/sources
# Source YNH helpers
. /usr/share/yunohost/helpers
# Copy Nginx and YunoHost parameters to make the script "standalone"
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
domain=$(sudo yunohost app setting $app domain)
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
app=${!#}
# Retrieve app settings
domain=$(sudo yunohost app setting "$app" domain)
# Save sources & data
ynh_backup "/var/www/${app}" "sources"
# Copy NGINX configuration
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"

View file

@ -1,16 +1,22 @@
#!/bin/bash
app=jappix
# The parameter $1 is the uncompressed restore directory location
backup_dir=$1/apps/$app
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
app=${!#}
# Retrieve arguments
backup_dir=$1
# Retrieve old app settings
domain=$(sudo yunohost app setting "$app" domain)
# Restore sources & data
sudo cp -a $backup_dir/sources/. /var/www/$app
sudo cp -a "./sources" "/var/www/$app"
# Restore Nginx and YunoHost parameters
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
domain=$(sudo yunohost app setting $app domain)
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
sudo cp -a $"./nginx.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
# Restart webserver
sudo service nginx reload
sudo service nginx reload