2016-02-09 00:48:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-07-21 12:18:50 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
2016-02-09 00:48:21 +01:00
|
|
|
|
2017-03-12 19:46:53 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
db_user=$app
|
|
|
|
db_name=$app
|
2016-02-09 00:48:21 +01:00
|
|
|
|
|
|
|
# retrieve useful param
|
2017-03-12 19:46:53 +01:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
path=$(ynh_app_setting_get $app path)
|
2016-02-09 00:48:21 +01:00
|
|
|
|
2018-07-21 12:18:50 +02:00
|
|
|
# Check web path availability
|
|
|
|
ynh_webpath_available $domain $path
|
|
|
|
# Register (book) web path
|
|
|
|
ynh_webpath_register $app $domain $path
|
2016-02-09 00:48:21 +01:00
|
|
|
|
2017-03-13 22:13:09 +01:00
|
|
|
db_pass=$(ynh_app_setting_get $app mysqlpwd)
|
|
|
|
|
2018-07-07 11:21:43 +02:00
|
|
|
#install php dependencies if necessary
|
|
|
|
install_freshrss_dependencies
|
|
|
|
|
2016-02-09 00:48:21 +01:00
|
|
|
# Restore sources & data
|
2017-03-12 19:46:53 +01:00
|
|
|
final_path=/var/www/$app
|
2017-12-03 12:39:12 +01:00
|
|
|
ynh_restore_file "$final_path"
|
2016-02-09 00:48:21 +01:00
|
|
|
|
|
|
|
# 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
|
2017-12-03 15:16:37 +01:00
|
|
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
ynh_restore_file "/etc/cron.d/$app"
|
2018-07-07 15:43:31 +02:00
|
|
|
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
2016-02-09 00:48:21 +01:00
|
|
|
|
|
|
|
# Restore mysql dump
|
2017-03-13 13:47:16 +01:00
|
|
|
ynh_mysql_create_db "$db_name" "$db_user" "$db_pass"
|
|
|
|
ynh_mysql_connect_as "$db_user" "$db_pass" "$db_name" < "$app.dmp"
|
2017-03-05 20:57:54 +01:00
|
|
|
|
2016-02-09 00:48:21 +01:00
|
|
|
# Reload Nginx, and regenerate SSOwat conf
|
|
|
|
sudo service nginx reload
|
2018-07-07 15:43:31 +02:00
|
|
|
sudo service php7.0-fpm reload
|
2016-02-09 00:48:21 +01:00
|
|
|
sudo yunohost app ssowatconf
|