Migrate winiso script to fish

This commit is contained in:
Manuel Thalmann 2024-09-03 12:08:47 +02:00
parent 4d4b6a9386
commit 2b73da1f64
2 changed files with 11 additions and 28 deletions

View file

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

View file

@ -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;