1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/headphones_ynh.git synced 2024-09-03 19:26:02 +02:00
headphones_ynh/scripts/backup
Snipees 9026d270c8 📦 init
import files
2015-08-23 17:57:27 +02:00

35 lines
No EOL
1,004 B
Bash

#!/bin/bash
# Set variables
app_id=headphones
app_user=headphones
app_install_dir=/opt/yunohost/$app_id
app_data_dir=/home/yunohost.app/$app_id
app_host=$(sudo yunohost app setting $app_id host)
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
mkdir -p $app_backup_dir
# Backup files if localhost installation
if [[ $app_host == "127.0.0.1" ]]; 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