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

37 lines
1 KiB
Text
Raw Normal View History

2015-08-23 17:57:27 +02:00
#!/bin/bash
2015-09-05 17:52:58 +02:00
# Common variable declaration
2015-08-23 17:57:27 +02:00
app_id=headphones
app_user=headphones
2015-09-05 17:52:58 +02:00
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)"
2015-08-23 17:57:27 +02:00
# The parameter $1 is the backup directory location
# which will be compressed afterward
2015-09-05 17:52:58 +02:00
app_backup_dir="$1/apps/${app_id}"
sudo mkdir -p $app_backup_dir
2015-08-23 17:57:27 +02:00
# Backup files if localhost installation
2015-09-05 17:52:58 +02:00
if [[ $app_method == "LOCAL"* ]]; then
2015-08-23 17:57:27 +02:00
# 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