From b1ddb0de48354ccb0e12185f250cb6881d098d16 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 8 Dec 2024 04:46:53 +0100 Subject: [PATCH] Remove bash profile during installation script --- scripts/Common/OS/setup.fish | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 962d32ec..b5f1ef52 100755 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -77,25 +77,34 @@ function runSetup and runHook --force autologin "Please set up a function `autologin` for setting up autologin for the `root` user" and begin - set -l script (string escape (getCloneFile (getInstallerScript))) + set -l profile "/root/.bash_profile" - wrapScript ( - string join " " \ - (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)) + begin + set -l profile (string escape "$profile") + set -l tmp (string escape "$profile""_") + set -l script (string escape (getCloneFile (getInstallerScript))) - end | runChroot "$mountDir" tee /root/.bash_profile >/dev/null + printf "%s\n" \ + "mv $profile $tmp" \ + (wrapScript ( + string join " " \ + (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) "&&")) \ + "rm $tmp ||" + "mv $tmp $profile" + end | runChroot "$mountDir" tee "$profile" >/dev/null + end end function actionPostRun