From d116b4c04c423966e8ce4dac30ecce6f47a63206 Mon Sep 17 00:00:00 2001 From: Fenris Wolf Date: Sat, 10 Oct 2026 17:58:00 +0200 Subject: [PATCH] [mod] serialization:postgresql_dump:password backup file --- source/logic/serialization/postgresql_dump.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/logic/serialization/postgresql_dump.ts b/source/logic/serialization/postgresql_dump.ts index cf01d89..76744ba 100644 --- a/source/logic/serialization/postgresql_dump.ts +++ b/source/logic/serialization/postgresql_dump.ts @@ -41,7 +41,17 @@ namespace _mimir.serialization.postgresql_dump ) : Array { const result : Array = []; - const password_file_path: string = "${HOME}/.pgpass"; + const password_file_path : string = "${HOME}/.pgpass"; + const password_file_backup_path : string = (password_file_path + ".bak"); + result.push( + lib_plankton.string.coin( + "test -f {{path_regular}} && cp {{path_regular}} {{path_backup}}", + { + "path_regular": password_file_path, + "path_backup": password_file_backup_path, + } + ) + ); result.push( lib_plankton.string.coin( "echo '{{host}}:{{port}}:{{schema}}:{{username}}:{{password}}' > {{path}} && chmod 0600 {{path}}", @@ -85,6 +95,15 @@ namespace _mimir.serialization.postgresql_dump } ) ); + result.push( + lib_plankton.string.coin( + "test -f {{path_backup}} && mv {{path_backup}} {{path_regular}}", + { + "path_regular": password_file_path, + "path_backup": password_file_backup_path, + } + ) + ); return result; }