From e4dc0ef2ec10731a538c60c3cba6c08d5ee96f34 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 3 Sep 2024 12:08:47 +0200 Subject: [PATCH] Migrate `winiso` script to `fish` --- winiso/deploy.fish | 14 +++++++++++--- winiso/deploy.sh | 25 ------------------------- 2 files changed, 11 insertions(+), 28 deletions(-) delete mode 100755 winiso/deploy.sh diff --git a/winiso/deploy.fish b/winiso/deploy.fish index 5e7a99c0..3a9bbd3f 100755 --- a/winiso/deploy.fish +++ b/winiso/deploy.fish @@ -1,11 +1,19 @@ #!/bin/env fish begin + set -l varName WIN11_IMAGE_PATH + set -l $varName set -l dir (status dirname) source "$dir/lib/choose-disk.fish" + set $varName (bash -c ". $(string escape $dir)/.env; echo \$$varName" 2> /dev/null) - set -q WIN11_IMAGE_PATH + [ ! -z "$$varName" ] or begin - echo "Please specify the Windows 11 ISO in the `WIN11_IMAGE_PATH` variable." + if [ ! -f "$dir/.env" ] + cp $dir/.env.template $dir/.env + end + + echo "Please epecify the path to the Windows 11 ISO image in your .env file located at:" + realpath --relative-to (pwd) (realpath $dir/.env) exit 1 end @@ -158,7 +166,7 @@ begin end mkdir -p "$(dirname "$winpe")" - sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath" + sudo mount --mkdir $$varName "$winPath" mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$winpe" sudo mount --mkdir "$winpe" "$winpePath" diff --git a/winiso/deploy.sh b/winiso/deploy.sh deleted file mode 100755 index 42a0b513..00000000 --- a/winiso/deploy.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -WIN_DISK="${WIN_DISK}"; -workingDir="$(pwd)"; -pushd "${BASH_SOURCE%/*}" > /dev/null; -. "./.env" > /dev/null 2>&1; - -if [ ! -z "$WIN11_IMAGE_PATH" ] -then - WIN11_IMAGE_PATH="$(bash -c "realpath $WIN11_IMAGE_PATH")"; -fi; - -if [ ! -f "$WIN11_IMAGE_PATH" ] -then - if [ ! -f "./.env" ] - then - cp .env.template .env; - fi; - - echo "Please specify the path to the Windows 11 ISO image in your .env file located at:"; - realpath --relative-to "$workingDir" "$(realpath .env)"; -else - WIN11_IMAGE_PATH="$WIN11_IMAGE_PATH" exec fish ./deploy.fish $@; -fi; - -popd > /dev/null;