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