Allow specifying custom chroot command

This commit is contained in:
Manuel Thalmann 2024-07-16 22:10:42 +02:00
parent f570c554f5
commit 122fe67a85
2 changed files with 14 additions and 4 deletions

View file

@ -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/wait-network.fish"
source "$dir/../../Common/Scripts/hooks.fish"

View file

@ -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..."