From c1d338c6994d11c8a6de20586bf921a7e10d45dd Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 24 Jul 2024 19:41:56 +0200 Subject: [PATCH] Dynamically generate the `startnet` script --- deploy.fish | 42 +++++++++++++++++++++++++---- winfs/Scripts/Startup.cmd | 4 --- winfs/Scripts/Startup.ps1 | 1 - winfs/Windows/System32/startnet.cmd | 6 ----- 4 files changed, 37 insertions(+), 16 deletions(-) delete mode 100644 winfs/Scripts/Startup.cmd delete mode 100644 winfs/Windows/System32/startnet.cmd diff --git a/deploy.fish b/deploy.fish index 8fb8ee3..e6a628c 100644 --- a/deploy.fish +++ b/deploy.fish @@ -55,13 +55,15 @@ begin set -l url "$entry[2]" set -l type "$entry[3]" set -l dir "$entry[4]" + set -l winPath "X:\\$(echo "$name" | sed "s/\//\\\\/g")" set -l file "$cacheDir/$name.$type" set -l target "$winpeOverlay/$name" set -a files \ "$file" \ "$dir" \ - "$name" + "$name" \ + "$winPath" mkdir -p (dirname "$file") @@ -87,13 +89,43 @@ begin end end - set -l intel $files[1..3] - set -l marvell $files[4..6] - set -l git $files[7..9] - set -l pwsh $files[10..12] + set -l intel $files[1..4] + set -l marvell $files[5..8] + set -l git $files[9..12] + set -l pwsh $files[13..16] cp -r "$dir/winfs"/* "$winpeOverlay" + begin + set -l startupFile "$winpeOverlay/Windows/System32/startnet.cmd" + mkdir -p (dirname "$startupFile") + + begin + set -l path + + for sw in git pwsh + set -a path $$sw[1][4] + end + + printf %s\n \ + "@echo off" \ + "echo Loading Drivers..." ( + string join ";" \ + "set PATH=%PATH%" \ + $path \ + "$git[4]\\bin" + ) \ + 'pwsh -file "X:\Scripts\Drivers.ps1"' \ + "echo Configuring Network..." \ + "wpeinit" \ + "echo Configuring keyboard layout..." \ + "wpeutil SetKeyboardLayout 0807:00000807" \ + "echo Disabling Energy Saving Mode..." \ + "powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" \ + 'start pwsh -NoExit -ExecutionPolicy bypass -file "X:\Scripts\Startup.ps1"' + end | sudo tee "$startupFile" > /dev/null + end + mkdir -p "$(dirname "$winpe")" sudo mount --mkdir "$WIN11_IMAGE_PATH" "$winPath" mkwinpeimg --iso --arch amd64 --overlay "$winpeOverlay" --windows-dir "$winPath" "$winpe" diff --git a/winfs/Scripts/Startup.cmd b/winfs/Scripts/Startup.cmd deleted file mode 100644 index 4f13188..0000000 --- a/winfs/Scripts/Startup.cmd +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -wpeutil SetKeyboardLayout 0807:00000807 -echo Launching Startup Script... -start X:\software\pwsh\pwsh.exe -NoExit -ExecutionPolicy bypass -file "X:\Scripts\Startup.ps1" diff --git a/winfs/Scripts/Startup.ps1 b/winfs/Scripts/Startup.ps1 index 7d37b6c..3a2cd80 100644 --- a/winfs/Scripts/Startup.ps1 +++ b/winfs/Scripts/Startup.ps1 @@ -1,6 +1,5 @@ $null = $env:WIN_COMPUTER_NAME; $null = $env:SETUP_SCRIPT_NAME; -Set-Alias git "X:/software/git/bin/git.exe"; git clone https://git.nuth.ch/manuth/PortValhalla.git; Set-Location PortValhalla; diff --git a/winfs/Windows/System32/startnet.cmd b/winfs/Windows/System32/startnet.cmd deleted file mode 100644 index 25e6cdb..0000000 --- a/winfs/Windows/System32/startnet.cmd +++ /dev/null @@ -1,6 +0,0 @@ -echo Loading Drivers... -X:\software\pwsh\pwsh.exe -file "X:\Scripts\Drivers.ps1" -echo Configuring Network... -wpeinit -powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c -X:\Scripts\Startup.cmd