diff --git a/scripts/Arch/OS/setup.fish b/scripts/Arch/OS/setup.fish index 7620564b..7982b847 100644 --- a/scripts/Arch/OS/setup.fish +++ b/scripts/Arch/OS/setup.fish @@ -7,6 +7,10 @@ begin set -l mountDir (getConfig valhalla.partition.rootDir) + function runChroot -S + arch-chroot $argv + end + function setupOS -S -V dir -V CONFIG_MODULE -V mountDir source "$dir/../../Common/Scripts/hooks.fish" source "$dir/../../Common/Scripts/wait-network.fish" diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 5b26f8ba..93a3bd90 100644 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -10,6 +10,12 @@ function runSetup set -l PROJECT_CLONE_ROOT "/opt/$(basename "$projectName")" set -l script (mktemp) + if not type -q runChroot + function runChroot -S + command chroot $argv + end + end + function getCloneFile -S -a path set -l relativeDir (realpath --relative-to "$projectRoot" "$dir") set -l relativePath (realpath --relative-to "$dir" "$path") @@ -19,9 +25,9 @@ function runSetup function runInOS -S set -l script "/root/run_once" wrapScript $argv | chroot "$mountDir" tee "$script" - chroot "$mountDir" chmod +x "$script" - chroot "$mountDir" "$script" - chroot "$mountDir" rm "$script" + runChroot "$mountDir" chmod +x "$script" + runChroot "$mountDir" "$script" + runChroot "$mountDir" rm "$script" end function wrapScript -S @@ -47,7 +53,7 @@ function runSetup and begin set -l script (string escape (getCloneFile (getInstallerScript))) wrapScript "INSTALLER_SCRIPT=$(string escape "$script") $script" - end | chroot "$mountDir" tee /root/.bash_profile > /dev/null + end | runChroot "$mountDir" tee /root/.bash_profile > /dev/null and echo "Setup finished!" and echo "This machine will reboot in 5 seconds..."