From ca2b623e1a527371fcc8e5744e99497ccae51e8a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 4 Dec 2024 19:02:05 +0100 Subject: [PATCH] Allow configuring backup during setup --- scripts/Common/OS/setup.fish | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 01efef1c..70ada965 100755 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -8,6 +8,7 @@ function runSetup function setupAction -V projectRoot -V PROJECT_CLONE_ROOT source "$dir/../../lib/hooks.fish" + source "$dir/../../lib/restoration.fish" source "$dir/../../lib/settings.fish" set -l mountDir (getOSConfig partition.rootDir) set -l script (mktemp) @@ -39,6 +40,14 @@ function runSetup "$argv" end + initBackupConfig --action restore + + if [ -n "$VALHALLA_BACKUP_SERVER_KEY" ] + set -l knownHosts /root/.ssh/known_hosts + cp "$VALHALLA_BACKUP_SERVER_KEY" "$mountDir$VALHALLA_BACKUP_SERVER_KEY" + cp $knownHosts "$mountDir$knownHosts" + end + and echo "Cloning project..." and source "$dir/../../lib/copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT" runChroot "$mountDir" git config --system --add safe.directory "$PROJECT_CLONE_ROOT" @@ -52,7 +61,18 @@ function runSetup wrapScript ( string join " " \ - "CONFIG_NAME=$(string escape "$CONFIG_NAME")" \ + (begin + for var in \ + CONFIG_NAME \ + VALHALLA_BACKUP_DISABLED \ + VALHALLA_BACKUP_DIR \ + VALHALLA_BACKUP_SERVER \ + VALHALLA_BACKUP_SERVER_PORT \ + VALHALLA_BACKUP_SERVER_USER \ + VALHALLA_BACKUP_SERVER_KEY + echo "$var=$(string escape "$$var")" + end + end) \ (string escape $script)) end | runChroot "$mountDir" tee /root/.bash_profile >/dev/null