Migrate winiso script to fish

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

View file

@ -1,11 +1,19 @@
#!/bin/env fish #!/bin/env fish
begin begin
set -l varName WIN11_IMAGE_PATH
set -l $varName
set -l dir (status dirname) set -l dir (status dirname)
source "$dir/lib/choose-disk.fish" 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 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 exit 1
end end
@ -158,7 +166,7 @@ begin
end end
mkdir -p "$(dirname "$winpe")" 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" mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$winpe"
sudo mount --mkdir "$winpe" "$winpePath" 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;