#!/bin/bash # Exit on command errors and treat unset variables as an error set -eu # Get multi-instances specific variables app=$YNH_APP_INSTANCE_NAME # Source app helpers . /usr/share/yunohost/helpers # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) mysql_db=$(ynh_app_setting_get "$app" mysql_db) # Copy the app files DESTDIR="/var/www/${app}" ynh_backup "$DESTDIR" "sources" 1 # Copy the conf files ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf" ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf" # Dump the database if [[ $mysql_db -eq 1 ]]; then dbname=$app dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql fi