From 28fd9b8640cd6208b53ac33f055ad6fef33749b1 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 16 Jul 2024 16:13:34 +0200 Subject: [PATCH] Allow executing scripts while installing OS --- scripts/Common/OS/setup.fish | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 7482faf0..5b26f8ba 100644 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -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!"