diff --git a/scripts/backup b/scripts/backup index 658a064..624e5ca 100755 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/restore b/scripts/restore index 071ffa9..acd423c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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 #=================================================