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

Add script for Backup / Restore

This commit is contained in:
inrepublica 2016-05-27 13:12:48 +02:00
parent 61ac4da964
commit 372bd478c1
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,17 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# See comments in install script
app=phpsysinfo
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Backup sources & data
ynh_backup "/var/www/${app}" "sources"
# Copy NGINX configuration
domain=$(ynh_app_setting_get "$app" domain)
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"

View file

@ -0,0 +1,32 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# See comments in install script
app=phpsysinfo
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Retrieve old app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
# Check domain/path availability
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# Restore sources & data
final_path="/var/www/${app}"
sudo cp -a ./sources "$final_path"
# Restore permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root:root "$final_path"
# Restore NGINX configuration
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
# Restart webserver
sudo service nginx reload