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
anmol26s d661060f0e
Restoration fail if the /var/www/$app don't exit
The app fails to restore if the /var/www/freshrss don't exits. Applied the latest helper to overcome it. I think it would solve the problem. But it needs to be tested. I will test it when I get the time.
Error log:
+ sudo chown -R root:root /var/www/freshrss
Warning: chown: cannot access ‘/var/www/freshrss’: No such file or directory
Error: Unable to restore the app 'freshrss'
2017-11-01 00:46:38 +05:30

40 lines
1,006 B
Bash

#!/bin/bash
set -eu
app=$YNH_APP_INSTANCE_NAME
db_user=$app
db_name=$app
# Source app helpers
. /usr/share/yunohost/helpers
# retrieve useful param
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation."
db_pass=$(ynh_app_setting_get $app mysqlpwd)
# Restore sources & data
ynh_restore_file "$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
ynh_backup nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
ynh_backup $app.cron /etc/cron.d/$app
# Restore mysql dump
ynh_mysql_create_db "$db_name" "$db_user" "$db_pass"
ynh_mysql_connect_as "$db_user" "$db_pass" "$db_name" < "$app.dmp"
# Reload Nginx, and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf