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:
parent
f49eabebc3
commit
43db84f4ad
2 changed files with 27 additions and 17 deletions
|
@ -1,15 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
app=jappix
|
app=jappix
|
||||||
|
|
||||||
# The parameter $1 is the backup directory location
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
# which will be compressed afterward
|
set -e
|
||||||
backup_dir=$1/apps/$app
|
|
||||||
mkdir -p $backup_dir
|
|
||||||
|
|
||||||
# Backup sources & data
|
# Source YNH helpers
|
||||||
sudo cp -a /var/www/$app/. $backup_dir/sources
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
app=${!#}
|
||||||
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
|
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
# Retrieve app settings
|
||||||
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf
|
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"
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
app=jappix
|
app=jappix
|
||||||
|
|
||||||
# The parameter $1 is the uncompressed restore directory location
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
backup_dir=$1/apps/$app
|
set -e
|
||||||
|
|
||||||
|
app=${!#}
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
backup_dir=$1
|
||||||
|
|
||||||
|
# Retrieve old app settings
|
||||||
|
domain=$(sudo yunohost app setting "$app" domain)
|
||||||
|
|
||||||
# Restore sources & data
|
# 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)
|
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
|
# Restart webserver
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
Loading…
Reference in a new issue