Allow executing scripts while installing OS

This commit is contained in:
Manuel Thalmann 2024-07-16 16:13:34 +02:00
parent cd5f68d0ef
commit e0d41f96cf

View file

@ -16,6 +16,21 @@ function runSetup
echo "$PROJECT_CLONE_ROOT/$relativeDir/$relativePath"
end
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"
end
function wrapScript -S
printf %s\n \
"cd $PROJECT_CLONE_ROOT" \
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \
"$argv"
end
getConfig valhalla.partition.script > "$script"
bash "$script"
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
@ -31,11 +46,7 @@ function runSetup
and begin
set -l script (string escape (getCloneFile (getInstallerScript)))
printf %s\n \
"cd $PROJECT_CLONE_ROOT" \
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \
"export INSTALLER_SCRIPT=$script" \
"$script"
wrapScript "INSTALLER_SCRIPT=$(string escape "$script") $script"
end | chroot "$mountDir" tee /root/.bash_profile > /dev/null
and echo "Setup finished!"