Dynamically generate the startnet script

This commit is contained in:
Manuel Thalmann 2024-07-24 19:41:56 +02:00
parent 24e557e95c
commit c1d338c699
4 changed files with 37 additions and 16 deletions

View file

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

View file

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

View file

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

View file

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