mirror of
https://github.com/YunoHost-Apps/osada_ynh.git
synced 2024-09-03 19:46:30 +02:00
fix restore
This commit is contained in:
parent
1beff8bd2a
commit
4a5ab0db7b
1 changed files with 2 additions and 53 deletions
|
@ -10,13 +10,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
#REMOVEME? ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -33,24 +26,6 @@ source /usr/share/yunohost/helpers
|
||||||
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
#REMOVEME? database=$(ynh_app_setting_get --app=$app --key=database)
|
#REMOVEME? database=$(ynh_app_setting_get --app=$app --key=database)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
|
|
||||||
|
|
||||||
#REMOVEME? test ! -d $install_dir \
|
|
||||||
|| ynh_die --message="There is already a directory: $install_dir "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD RESTORATION STEPS
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,18 +46,6 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
|
||||||
|
|
||||||
if [ $database = "postgresql" ]; then
|
|
||||||
#REMOVEME? pkg_dependencies="$pkg_dependencies $pg_pkg_dependencies"
|
|
||||||
fi
|
|
||||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,22 +65,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..."
|
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..."
|
||||||
|
|
||||||
if [ $database = "mysql" ]; then
|
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||||
#REMOVEME? ynh_script_progression --message="Restoring MySQL database..."
|
|
||||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|
||||||
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
|
||||||
elif [ $database = "postgresql" ]; then
|
|
||||||
# Removing postgresql database
|
|
||||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
|
||||||
# Define and install dependencies
|
|
||||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..."
|
|
||||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
||||||
#REMOVEME? ynh_psql_test_if_first_run
|
|
||||||
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
||||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
|
|
Loading…
Add table
Reference in a new issue