simplify backup and restore

This commit is contained in:
Benedikt Tissot 2021-04-05 17:12:00 +02:00
parent b2871b79c0
commit 54002b17b6
2 changed files with 2 additions and 12 deletions

View file

@ -27,18 +27,9 @@ ynh_abort_if_errors
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path)
# synapse_instance=$(ynh_app_setting_get --app=$app --key=synapse_instance)
mautrix_bridge_db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name)
# mautrix_bridge_db_user=$app
# mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
# mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP

View file

@ -31,9 +31,9 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
mautrix_bridge_db_name=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_name)
mautrix_bridge_db_user=$mautrix_bridge_db_name
mautrix_bridge_db_pwd=$(ynh_app_setting_get --app=$app --key=mautrix_bridge_db_pwd)
app_service_registration_path=$(ynh_app_setting_get --app=$app --key=app_service_registration_path)
mautrix_bridge_db_user=$mautrix_bridge_db_name
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -90,8 +90,7 @@ ynh_psql_create_user $mautrix_bridge_db_user $mautrix_bridge_db_pwd
ynh_print_ON
ynh_psql_execute_as_root \
--sql="CREATE DATABASE ""$mautrix_bridge_db_name"" ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER ""$mautrix_bridge_db_user"";"
ynh_psql_connect_as --user=$mautrix_bridge_db_user --password=$mautrix_bridge_db_pwd --database=$mautrix_bridge_db_name < ./db.sql
ynh_psql_execute_file_as_root --file="db.sql" --database="$mautrix_bridge_db_name"
#=================================================
# RESTORE SYSTEMD
#=================================================