#!/bin/bash # Common variable declaration app_id=headphones app_user=headphones app_install_dir="/opt/yunohost/${app_id}" app_data_dir="/home/yunohost.app/${app_id}" # Retrieve arguments app_method="$(sudo yunohost app setting ${app_id} method)" app_domain="$(sudo yunohost app setting ${app_id} domain)" # The parameter $1 is the backup directory location # which will be compressed afterward app_backup_dir="$1/apps/${app_id}" sudo mkdir -p $app_backup_dir # Backup files if localhost installation if [[ $app_method == "LOCAL"* ]]; then # Backup sources sudo cp -a $app_install_dir/. $app_backup_dir/sources # Backup data sudo cp -a $app_data_dir/. $app_backup_dir/data # Backup daemon config sudo cp -a /etc/default/$app_id $app_backup_dir/conf/$app_id.default sudo cp -a /etc/init.d/$app_id $app_backup_dir/conf/$app_id.init fi # Copy Nginx and YunoHost parameters to make the script "standalone" sudo cp -a /etc/yunohost/apps/$app_id/. $app_backup_dir/yunohost sudo cp -a /etc/nginx/conf.d/$app_domain.d/$app_id.conf $app_backup_dir/nginx.conf