From a5e17204636054f583b9e9cc216f368fcc2b89c0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 13 Apr 2023 12:28:53 +0000 Subject: [PATCH] refining scripts, adding winpe boot --- configure-debian-system.sh | 4 +++- configure-windows-pxeboot.sh | 26 +++++++++++++++++++++++-- config-full.sh => generate-full-menu.sh | 0 generate-minimal-menu.sh | 11 +++++++++++ resources/default-full | 15 +++++++++++++- resources/default-minimal | 10 +++++++--- resources/smb.conf | 16 +++++++++++++++ runall.sh | 5 +++-- 8 files changed, 78 insertions(+), 9 deletions(-) rename config-full.sh => generate-full-menu.sh (100%) create mode 100755 generate-minimal-menu.sh create mode 100644 resources/smb.conf diff --git a/configure-debian-system.sh b/configure-debian-system.sh index b1fe103..d531d98 100755 --- a/configure-debian-system.sh +++ b/configure-debian-system.sh @@ -10,7 +10,9 @@ mkdir -p ${TFTP}/pxelinux.cfg # copy Files from the Resource-Dir to the correct places: cp ./resources/lighttpd.conf /etc/lighttpd/lighttpd.conf cp ./resources/exports /etc/exports -cp ./resources/default-minimal ${TFTP}/pxelinux.cfg/default +if ! [ -e ${TFTP}/pxelinux.cfg/default ]; then + cp ./resources/default-minimal ${TFTP}/pxelinux.cfg/default +fi cp ./resources/splash.png ${TFTP}/ cp -a /usr/lib/syslinux/modules/bios ${TFTP}/ diff --git a/configure-windows-pxeboot.sh b/configure-windows-pxeboot.sh index 9eb9e63..c38703c 100644 --- a/configure-windows-pxeboot.sh +++ b/configure-windows-pxeboot.sh @@ -2,16 +2,38 @@ . ./settings.sh -# Download Debian Packages +# Download & Install Debian Packages apt update apt install -y samba genisoimage wimtools cabextract -# setup temp-dirs: +# configure Packages +cp ./resources/smb.conf /etc/samba/ + +# setup dirs: +mkdir -p ./non-free/windows mkdir -p ./temp/waik +# restart services +systemctl restart smbd + # Download Windows Stuff: WAIKURL="https://download.microsoft.com/download/8/E/9/8E9BBC64-E6F8-457C-9B8D-F6C9A16E6D6A/KB3AIK_EN.iso" FILENAME="./temp/KB3AIK_EN.iso" if ! [ -e $FILENAME ]; then wget -nc -O $FILENAME $WAIKURL fi + +if [ -e $FILENAME ]; then + 7z x -aos -o./temp/waik $FILENAME +fi + +# Create winpe.iso +if ! [ -e ./non-free/windows/winpe.iso ]; then + if [ -e ./temp/waik/WinPE.cab ]; then + mkwinpeimg --iso --arch=amd64 --waik-dir=./temp/waik ./non-free/windows/winpe.iso + fi +fi + +# copy files to tftp server +cp -av ./non-free/windows ${TFTP}/non-free/ + diff --git a/config-full.sh b/generate-full-menu.sh similarity index 100% rename from config-full.sh rename to generate-full-menu.sh diff --git a/generate-minimal-menu.sh b/generate-minimal-menu.sh new file mode 100755 index 0000000..b7d2520 --- /dev/null +++ b/generate-minimal-menu.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./settings.sh + +echo "Generating PXE Menu..." +cat ./resources/default-minimal | \ + sed -e "s/__NFSSERVERIP__/${NFSSERVERIP}/g" \ + -e "s/__MENUTITLE__/${MENUTUTLE}/g" \ + -e "s/__MENUBACKGROUND__/${MENUBACKGROUND}/g" > ${TFTP}/pxelinux.cfg/default + +./configure-debian-system.sh diff --git a/resources/default-full b/resources/default-full index 0b57da1..45d8c09 100644 --- a/resources/default-full +++ b/resources/default-full @@ -110,7 +110,7 @@ label - MENU DISABLE MENU BEGIN - MENU LABEL * Debian Installer... + MENU LABEL * Linux Installer... LABEL deb12 MENU LABEL * Debian 12 Installer 64Bit Textmodus @@ -134,6 +134,19 @@ MENU BEGIN MENU EXIT MENU END +MENU BEGIN + MENU LABEL * Windows Installer... + + LABEL win10 + MENU LABEL * Windows 10 + KERNEL memdisk + INITRD non-free/windows/winpe.iso + APPEND iso raw + + LABEL zurueck... + MENU EXIT +MENU END + label - MENU LABEL Boot- & System-Tools: -------------------- MENU DISABLE diff --git a/resources/default-minimal b/resources/default-minimal index b82bed4..453b776 100755 --- a/resources/default-minimal +++ b/resources/default-minimal @@ -3,8 +3,8 @@ path bios default bios/vesamenu.c32 TIMEOUT 300 -MENU TITLE PXE Bootserver -MENU BACKGROUND splash.png +MENU TITLE PXE __MENUTITLE__ +MENU BACKGROUND __MENUBACKGROUND__ LABEL disk0 localboot 0 @@ -22,5 +22,9 @@ LABEL demo KERNEL ipxe.lkrn dhcp && chain http://boot.ipxe.org/demo/boot.php LABEL fdos - MENU LABEL * iPXE FreeDOS over HTTP + MENU LABEL * iPXE FreeDOS over HTTP and Internet KERNEL ipxe.lkrn dhcp && sanboot http://boot.ipxe.org/freedos/fdfullcd.iso + +LABEL fdos + MENU LABEL * iPXE FreeDOS over HTTP Local Server + KERNEL ipxe.lkrn dhcp && sanboot http://__NFSSERVERIP__/free/FD13LIVE.iso diff --git a/resources/smb.conf b/resources/smb.conf new file mode 100644 index 0000000..bdc8d56 --- /dev/null +++ b/resources/smb.conf @@ -0,0 +1,16 @@ +[global] + workgroup = PXE + map to guest = bad user + usershare allow guests = yes + +[tftp] + browsable = true + read only = yes + guest ok = yes + path = /srv/tftp + +[windows] + browsable = true + read only = yes + guest ok = yes + path = /srv/tftp/non-free/windows diff --git a/runall.sh b/runall.sh index 7c00da8..b238305 100755 --- a/runall.sh +++ b/runall.sh @@ -8,8 +8,9 @@ # 2. configure debian system ./configure-debian-system.sh -# 3. configure full system, copy some stuff (not the non-free...) - ./config-full.sh +# 3. configure full system menu + ./generate-full-menu.sh + #./generate-minimal-menu.sh # 4. download free stuff (knoppix...) ./download-free.sh