From afbff7ac8ccfc9083886ba3c5080354d9fcfb81d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 12 Sep 2024 18:44:14 +0200 Subject: [PATCH] Execute partition script using shebang --- lib/modules/partition/disks.nix | 7 +++++-- scripts/Common/OS/setup.fish | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/modules/partition/disks.nix b/lib/modules/partition/disks.nix index 25249dbf..9e761b4d 100644 --- a/lib/modules/partition/disks.nix +++ b/lib/modules/partition/disks.nix @@ -344,8 +344,11 @@ sudo swapon ${partPath _} '') (builtins.filter (_: _.useSwap) partitions)); - in lib.strings.concatLines ( - (builtins.map (_: _.deviceScript) disks) ++ lib.optionals ((builtins.length disks) > 0) [ + in lib.strings.concatLines ([ + "#!/bin/bash" + ] ++ + (builtins.map (_: _.deviceScript) disks) ++ + lib.optionals ((builtins.length disks) > 0) [ ". ${./../../../scripts/Common/Scripts/is-truthy.sh}" ''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"'' (''echo "Continuing this script will alter the partitions of '' + ( diff --git a/scripts/Common/OS/setup.fish b/scripts/Common/OS/setup.fish index 75d19ccd..9781131e 100755 --- a/scripts/Common/OS/setup.fish +++ b/scripts/Common/OS/setup.fish @@ -8,6 +8,7 @@ function runSetup set -l projectName (basename "$projectRoot") set -l PROJECT_CLONE_ROOT "/opt/$(basename "$projectName")" set -l script (mktemp) + chmod +x "$script" if not type -q runChroot function runChroot -S @@ -44,7 +45,8 @@ function runSetup end getConfig valhalla.partition.script > "$script" - bash "$script" + and "$script" + and rm "$script" # Copy `nixpkgs` channel and begin