almost allow the windows 11 installer to start unattended

This commit is contained in:
Charlotte 🦝 Delenk 2023-05-24 14:39:08 +01:00
parent 8f2a28fdf2
commit e7b042bf80
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
2 changed files with 44 additions and 2 deletions

View file

@ -18,6 +18,31 @@
outputHashMode = "flat"; outputHashMode = "flat";
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
}; };
installBat = pkgs.writeText "install.bat" ''
wpeinit
ipconfig
net use i: \\192.168.2.1\INSTALL /user:none none
i:
setup.exe /AddBootMgrLast
'';
winpeshlIni = pkgs.writeText "winpeshl.ini" ''
[LaunchhApps]
"install.bat"
'';
win11SetupDir = pkgs.stdenv.mkDerivation {
name = "win11-boot";
src = pkgs.emptyDirectory;
nativeBuildInputs = [pkgs.p7zip];
buildPhase = "";
installPhase = ''
mkdir $out
cd $out
7z x ${win11Iso} boot efi sources/boot.wim
ln -sv ${installBat} install.bat
ln -sv ${winpeshlIni} winpeshl.ini
'';
};
win11IsoDir = pkgs.stdenv.mkDerivation { win11IsoDir = pkgs.stdenv.mkDerivation {
name = "win11"; name = "win11";
@ -27,6 +52,7 @@
installPhase = '' installPhase = ''
mkdir $out mkdir $out
ln -sv ${win11Iso} $out/win11.iso ln -sv ${win11Iso} $out/win11.iso
ln -sv ${win11SetupDir} $out/setup
''; '';
}; };
bootIpxeX86Script = pkgs.writeTextDir "boot.ipxe" '' bootIpxeX86Script = pkgs.writeTextDir "boot.ipxe" ''
@ -45,7 +71,18 @@
chain http://192.168.2.1/x86_64/netboot.ipxe chain http://192.168.2.1/x86_64/netboot.ipxe
:windows :windows
sanboot http://192.168.2.1/x86_64/win11.iso imgfree
kernel http://192.168.2.1/x86_64/share/wimboot/wimboot.x86_64.efi gui
initrd http://192.168.2.1/x86_64/setup/install.bat install.bat
initrd http://192.168.2.1/x86_64/setup/winpeshl.ini winpeshl.ini
initrd http://192.168.2.1/x86_64/setup/efi/microsoft/boot/bcd BCD
initrd http://192.168.2.1/x86_64/setup/boot/fonts/segmono_boot.ttf segmono_boot.ttf
initrd http://192.168.2.1/x86_64/setup/boot/fonts/segoe_slboot.ttf segoe_slboot.ttf
initrd http://192.168.2.1/x86_64/setup/boot/fonts/segoen_slboot.ttf segoen_slboot.ttf
initrd http://192.168.2.1/x86_64/setup/boot/fonts/wgl4_boot.ttf wgl4_boot.ttf
initrd http://192.168.2.1/x86_64/setup/boot/boot.sdi boot.sdi
initrd http://192.168.2.1/x86_64/setup/sources/boot.wim boot.wim
boot
:shell :shell
chain http://192.168.2.1/x86_64/shell.efi chain http://192.168.2.1/x86_64/shell.efi
@ -63,6 +100,7 @@
pkgs.edk2-uefi-shell pkgs.edk2-uefi-shell
bootIpxeX86Script bootIpxeX86Script
win11IsoDir win11IsoDir
pkgs.wimboot
]; ];
}; };
bootIpxeScript = pkgs.writeText "boot.ipxe" '' bootIpxeScript = pkgs.writeText "boot.ipxe" ''
@ -130,4 +168,8 @@ in {
"net.ipv4.conf.all.forwarding" = true; "net.ipv4.conf.all.forwarding" = true;
"net.ipv6.conf.all.forwarding" = true; "net.ipv6.conf.all.forwarding" = true;
}; };
fileSystems."/mnt/win" = {
device = "${win11Iso}";
options = ["loop" "ro"];
};
} }

View file

@ -23,7 +23,7 @@ _: {
map to guest = bad user map to guest = bad user
''; '';
shares = { shares = {
winstall = { install = {
path = "/mnt/win"; path = "/mnt/win";
browseable = "yes"; browseable = "yes";
"read only" = "yes"; "read only" = "yes";