1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/scripts/restore

40 lines
1.1 KiB
Text
Raw Normal View History

2016-02-09 00:48:21 +01:00
#!/bin/bash
set -e
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
# The parameter $2 is the id of the app instance ex: strut__2
APP=$2
2017-02-14 09:40:18 +01:00
# Source app helpers
. /usr/share/yunohost/helpers
2016-02-09 00:48:21 +01:00
# retrieve useful param
2017-02-14 09:40:18 +01:00
domain=$(ynh_app_setting_get ${APP} domain)
path=$(ynh_app_setting_get ${APP} path)
2016-02-09 00:48:21 +01:00
# Check domain/path availability
2017-02-14 09:40:18 +01:00
sudo yunohost app checkurl $domain$path -a ${APP} || ynh_die "The path ${domain}${path} is not available for app installation."
2016-02-09 00:48:21 +01:00
# Restore sources & data
final_path=/var/www/${APP}
sudo mkdir $final_path
sudo cp -a ${BACKUP_DIR}/www/. $final_path
# Restore permissions
sudo chown -R root:root $final_path
sudo chown -R www-data: $final_path/data/
sudo chown -R www-data: $final_path/extensions/
# Restore conf files
sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.conf
sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP}
# Restore mysql dump
2017-02-14 09:40:18 +01:00
ynh_mysql_execute_file_as_root "${BACKUP_DIR}/${APP}.dmp" "${APP}"
2016-02-09 00:48:21 +01:00
# Reload Nginx, and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf