2017-02-07 02:00:31 +01:00
|
|
|
#!/bin/bash
|
2017-02-08 23:15:36 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-02-08 23:15:36 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
source _common.sh
|
2017-02-08 23:15:36 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
2017-02-08 23:15:36 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2017-02-07 02:00:31 +01:00
|
|
|
|
|
|
|
export app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
export domain=$(ynh_app_setting_get $app domain)
|
2018-03-13 21:49:11 +01:00
|
|
|
export path_url=$(ynh_app_setting_get $app path_url)
|
2017-02-07 02:00:31 +01:00
|
|
|
export admin=$(ynh_app_setting_get $app admin)
|
2018-03-13 21:49:11 +01:00
|
|
|
export final_path=$(ynh_app_setting_get $app final_path)
|
2017-02-07 02:00:31 +01:00
|
|
|
export is_public=$(ynh_app_setting_get $app is_public)
|
|
|
|
export prefix=$(ynh_app_setting_get $app prefix)
|
2018-03-13 21:49:11 +01:00
|
|
|
export db_name=$(ynh_app_setting_get $app db_name)
|
|
|
|
export db_user=$(ynh_app_setting_get $app db_user)
|
|
|
|
export db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
2017-02-07 02:00:31 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF THE APP CAN BE RESTORED
|
|
|
|
#=================================================
|
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
ynh_webpath_available $domain $path_url \
|
|
|
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
|
|
|
test ! -d $final_path \
|
|
|
|
|| ynh_die "There is already a directory: $final_path "
|
2017-02-07 02:00:31 +01:00
|
|
|
|
|
|
|
#=================================================
|
2018-03-13 21:49:11 +01:00
|
|
|
# STANDARD RESTORE STEPS
|
|
|
|
#=================================================
|
|
|
|
# INSTALL DEPENDENCIES
|
2017-02-07 02:00:31 +01:00
|
|
|
#=================================================
|
2018-03-13 21:49:11 +01:00
|
|
|
ynh_install_app_dependencies $pkg_dependencies
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE OF THE SQL BDD
|
|
|
|
#=================================================
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
|
|
|
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# RESTORE FILES
|
|
|
|
#=================================================
|
|
|
|
# Restore files
|
2017-02-07 02:00:31 +01:00
|
|
|
ynh_restore
|
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# RECREATE THE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
ynh_system_user_create "$app" "$final_path"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE USER RIGHTS
|
|
|
|
#=================================================
|
|
|
|
set_permissions
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP SSOWAT
|
|
|
|
#=================================================
|
2017-02-07 02:00:31 +01:00
|
|
|
ynh_sso_access "/index.php?r=admin,/index.php?r=plugins,/scripts"
|
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX AND PHP-FPM
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_system_reload php5-fpm
|
|
|
|
ynh_system_reload nginx
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SEND A README FOR THE ADMIN
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/leed_ynh"
|
|
|
|
|
|
|
|
ynh_send_readme_to_admin "$message" "$admin"
|