2017-01-28 23:39:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-29 16:06:59 +01:00
|
|
|
set -eu
|
2017-01-28 23:39:42 +01:00
|
|
|
|
2017-01-29 16:11:05 +01:00
|
|
|
# Source app helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2017-01-28 23:39:42 +01:00
|
|
|
|
|
|
|
# This is a multi-instance app, meaning it can be installed several times independently
|
|
|
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
|
|
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
|
|
# The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
|
|
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
|
|
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
|
|
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
|
|
# The app instance name is probably what you are interested the most, since this is
|
|
|
|
# guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
|
|
# db names, ...
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2017-01-29 16:06:41 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-01-28 23:39:42 +01:00
|
|
|
# Retrieve arguments
|
2017-01-29 18:42:57 +01:00
|
|
|
domain=$(ynh_app_setting_set $app domain)
|
2017-01-28 23:39:42 +01:00
|
|
|
|
|
|
|
# Backup directory location for the app from where the script is executed and
|
|
|
|
# which will be compressed afterward
|
|
|
|
backup_dir=$YNH_APP_BACKUP_DIR
|
|
|
|
|
|
|
|
# Backup sources & data
|
|
|
|
ynh_backup "/var/www/$app" "sources"
|
|
|
|
|
|
|
|
# Copy Nginx conf
|
|
|
|
sudo mkdir -p ./conf
|
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|