[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] Rework PXE installation setup to be compliant with re-written LTSP.

WolfgangSchweer gitlab at salsa.debian.org
Sun Mar 15 22:40:31 GMT 2020



WolfgangSchweer pushed to branch master at Debian Edu / debian-edu-config


Commits:
168da215 by Wolfgang Schweer at 2020-03-15T23:34:08+01:00
Rework PXE installation setup to be compliant with re-written LTSP.

These changes have the additional benefit to provide network booting for both
BIOS and UEFI based systems due to the change to iPXE.

- ldap-bootstrap/gosa-server.ldif:
  + Add DHCP options to provide an iPXE related config space.
  + Add system architecture related DHCP option.
  + Add DHCP statement to be able to conditionally hand out the correct boot
    file. This also makes sure that both PXE and iPXE capable systems are
    supported via chainloading iPXE.

- sbin/debian-edu-pxeinstall:
  + Switch to iPXE to provide the installation menu.
  + Modify the existing iPXE menu in case of a combined server, i.e. main
    server and LTSP server.
  + Generate an iPXE menue in case of a plain main server.
  + Cleanup from outdated and obsolete comments and code.
  + Whitespace fixes.

- etc/debian-edu/pxeinstall.conf:
  + Use the graphical installer by default.
  + Adjust entries and comments to reflect the changes.

Signed-off-by: Wolfgang Schweer <wschweer at arcor.de>

- - - - -


4 changed files:

- debian/changelog
- etc/debian-edu/pxeinstall.conf
- ldap-bootstrap/gosa-server.ldif
- sbin/debian-edu-pxeinstall


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,27 @@
+debian-edu-config (2.11.17) UNRELEASED; urgency=medium
+
+  * Rework PXE installation setup to be compliant with re-written LTSP. These
+    changes have the additional benefit to provide network booting for both
+    BIOS and UEFI based systems due to the change to iPXE.
+    - ldap-bootstrap/gosa-server.ldif:
+      + Add DHCP options to provide an iPXE related config space.
+      + Add system architecture related DHCP option.
+      + Add DHCP statement to be able to conditionally hand out the correct boot
+        file. This also makes sure that both PXE and iPXE capable systems are
+        supported via chainloading iPXE.
+    - sbin/debian-edu-pxeinstall:
+      + Switch to iPXE to provide the installation menu.
+      + Modify the existing iPXE menu in case of a combined server, i.e. main
+        server and LTSP server.
+      + Generate an iPXE menue in case of a plain main server.
+      + Cleanup from outdated and obsolete comments and code.
+      + Whitespace fixes.
+    - etc/debian-edu/pxeinstall.conf:
+      + Use the graphical installer by default.
+      + Adjust entries and comments to reflect the changes.
+
+ -- Wolfgang Schweer <wschweer at arcor.de>  Sat, 14 Mar 2020 23:08:36 +0100
+
 debian-edu-config (2.11.16) unstable; urgency=medium
 
   [ Wolfgang Schweer ]


=====================================
etc/debian-edu/pxeinstall.conf
=====================================
@@ -1,26 +1,15 @@
-# Examples for local settings. Run 'debian-edu-pxeinstall' to regenerate
-# the PXE menu for any changes to take effect.
-
-# Default LTSP chroot arch is like the server arch.
-# If set differently, an appropriate LTSP chroot and changes in LDAP are
-# needed; see the manual for details.
-#ltsparch=i386
-
-# Set if NFS instead of default NBD is to be used for LTSP (10.0.0.0/8 network);
-# see the manual for details.
-#rootdev=nfs
+# Examples for local settings. Run 'debian-edu-pxeinstall' to re-generate the netboot
+# environment and the iPXE menu each time any changes have been made..
 
 # Set a different desktop environment for new installations instead of the default xfce one.
 #mydesktop=mate
 
-# Set if the Debian Installer should be run in graphical instead of text mode.
-#graphicdi=true
+# Comment the next entry if the Debian Installer should be run in text mode.
+graphicdi=true
 
 # If e.g. 'apt-cacher-ng' is running on the gateway and should be used for installation.
 #http_proxy=http://10.0.0.1:3142
 #ftp_proxy=http://10.0.0.1:3142
 
 # Set this during development to test if daily d-i netboot.tar.gz is working.
-# Run 'rm -rf /var/lib/tftpboot/debian-installer' followed by 'debian-edu-pxeinstall' after
-# setting it, and remember to run both commands also once this is commented again.
 #dailydi=true


=====================================
ldap-bootstrap/gosa-server.ldif
=====================================
@@ -20,12 +20,17 @@ ipHostNumber: 10.0.2.2
 gotoMode: locked
 
 dn: cn=dhcp,cn=tjener,ou=servers,ou=systems,dc=skole,dc=skolelinux,dc=no
-dhcpOption: smtp-server code 69 = array of ip-address
-dhcpOption: wpad-url code 252 = text
 dhcpStatements: authoritative 
 dhcpStatements: ddns-update-style none
 dhcpStatements: max-lease-time 3600
 dhcpStatements: default-lease-time 1800
+dhcpOption: smtp-server code 69 = array of ip-address
+dhcpOption: wpad-url code 252 = text
+dhcpOption: space ipxe
+dhcpOption: ipxe-encap-opts code 175 = encapsulate ipxe
+dhcpOption: ipxe.menu code 39 = unsigned integer 8
+dhcpOption: ipxe.no-pxedhcp code 176 = unsigned integer 8
+dhcpOption: arch code 93 = unsigned integer 16
 cn: dhcp
 objectClass: top
 objectClass: dhcpService
@@ -228,11 +233,11 @@ dhcpOption: domain-name-servers 10.0.2.2
 dhcpStatements: default-lease-time 1800
 dhcpStatements: max-lease-time 3600
 dhcpStatements: next-server tjener
-dhcpStatements: filename "/var/lib/tftpboot/pxelinux.0"
 dhcpStatements: authoritative
 dhcpStatements: allow unknown-clients
 dhcpStatements: allow bootp
 dhcpStatements: allow booting
+dhcpStatements: if exists ipxe.menu { filename "ltsp/ltsp.ipxe"; } elsif option arch = 00:00 { filename "ltsp/undionly.kpxe"; } elsif option arch = 00:07 { filename "ltsp/snponly.efi"; } elsif option arch = 00:09 { filename "ltsp/snponly.efi"; } else { filename "ltsp/unmatched-client"; }
 cn: intern
 objectClass: top
 objectClass: dhcpSharedNetwork


=====================================
sbin/debian-edu-pxeinstall
=====================================
@@ -4,9 +4,6 @@
 #
 # A better idea might be to use di-netboot-assistant,
 # <URL:http://www.klabs.be/~fpiat/linux/debian/di-netboot-assistant/>.
-# See also the original bin/debian-edu-pxelinux.cfg 
-# (bin/debian-edu-pxelinux.cfg has been removed from the 
-# debian-edu-config source after 1.443~svn66662)
 
 set -e
 
@@ -18,23 +15,23 @@ export LC_ALL
 ## Try to find the DNS from the leases file, if that fails use
 ## default DNS:
 if [ ! -s /etc/resolv.conf ] ; then
-    DNS="10.0.2.2"
-    LEASEDIR=/var/lib/dhcp/
-    if [ -d $LEASEDIR ] ; then
-	LEASEFILE=$LEASEDIR`ls -tr -1 $LEASEDIR | tail -n 1`
-	if [ -r $LEASEFILE ] ; then
-	    if DNSLEASE=`cat $LEASEFILE | grep domain-name-servers | \
-		tail -n 1 | \
-		grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"` ; then
-		DNS=$DNSLEASE
-		echo "info: Found leases file and domain-name-server: $DNS."
-	    else
-		echo "info: Could not extract DNS from leases file."
-	    fi
+	DNS="10.0.2.2"
+	LEASEDIR=/var/lib/dhcp/
+	if [ -d $LEASEDIR ] ; then
+		LEASEFILE=$LEASEDIR`ls -tr -1 $LEASEDIR | tail -n 1`
+		if [ -r $LEASEFILE ] ; then
+			if DNSLEASE=`cat $LEASEFILE | grep domain-name-servers | \
+				tail -n 1 | \
+				grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"` ; then
+				DNS=$DNSLEASE
+				echo "info: Found leases file and domain-name-server: $DNS."
+			else
+				echo "info: Could not extract DNS from leases file."
+			fi
+		fi
 	fi
-    fi
-    echo "info: Create temporary /etc/resolv.conf with DNS: $DNS."
-    cat >> /etc/resolv.conf <<EOF
+	echo "info: Create temporary /etc/resolv.conf with DNS: $DNS."
+	cat >> /etc/resolv.conf <<EOF
 ## This is a temporary resolv.conf created by $0.
 ## If you find it after installation, something went wrong. Try to replace it 
 ## by a symlink: /etc/resolv.conf -> /etc/resolvconf/run/resolv.conf, i.e.: 
@@ -42,7 +39,7 @@ if [ ! -s /etc/resolv.conf ] ; then
 nameserver $DNS
 search intern
 EOF
-fi
+	fi
 
 # Make sure the created directories and files are readable by tfptd
 # run as user nobody.
@@ -50,31 +47,29 @@ umask 022
 
 # Fetch ftp_proxy and http_proxy if set globally
 if [ -f /etc/environment ] ; then
-    . /etc/environment
+	. /etc/environment
 fi
 
 [ "$dist" ]       || dist=$(lsb_release -sc)
 [ "$archs" ]      || archs="amd64 i386"
-[ "$ltsparch" ]   || ltsparch=$(dpkg --print-architecture)
 [ "$mirrorurl" ]  || mirrorurl=http://deb.debian.org/debian
 [ "$hostname" ]   || hostname=pxeinstall
 [ "$domain" ]     || domain=intern
 [ "$mydesktop" ]  || mydesktop=xfce
 [ "$graphicdi" ]  || graphicdi=false
 [ "$dailydi" ]    || dailydi=false
-[ "$rootdev" ]    || rootdev=nbd0
 # Not hardcoded to allow PXE installation of a main-server without a
 # proxy set
 #[ "$http_proxy" ] || http_proxy=http://webcache:3128
 #[ "$ftp_proxy" ] || ftp_proxy=http://webcache:3128
 
 if [ -f /etc/debian-edu/config ] ; then
-    . /etc/debian-edu/config
+	. /etc/debian-edu/config
 fi
 
 # Allow site specific overrides to the variables
 if [ -f /etc/debian-edu/pxeinstall.conf ] ; then
-    . /etc/debian-edu/pxeinstall.conf
+	. /etc/debian-edu/pxeinstall.conf
 fi
 
 # This part does not work from within debian-installer, as it is
@@ -84,30 +79,30 @@ fi
 # debian-edu-install, copying the files a bit earlier.
 installconfig=""
 for template in debian-installer/locale \
-    keyboard-configuration/xkb-keymap \
-    tasksel/desktop; do
-    value="$(debconf-get-selections --installer | grep $template | awk '{print $4}')"
-    if [ -z "$value" ] ; then
-       # If there is no value in the installer debconf database, set the default one.
-       # Useful if modular main server installation has been used (no desktop).
-	value="$mydesktop"
-    fi
-
-    # Using desktop= as kernel argument work, while tasksel/desktop=
-    # do not.  No idea why, but lets use the one that work.
-    if [ "tasksel/desktop" = $template ] ; then template=desktop ; desktop=$value; fi
-
-    # Map the long name to the short alias, to keep the argument list
-    # shorter.
-    if [ "debian-installer/locale" = $template ] ; then template=locale; fi
-    if [ "keyboard-configuration/xkb-keymap" = $template ] ; then template=keymap; fi
-
-    if [ "$value" ] ; then
+	keyboard-configuration/xkb-keymap \
+	tasksel/desktop; do
+	value="$(debconf-get-selections --installer | grep $template | awk '{print $4}')"
+	if [ -z "$value" ] ; then
+		# If there is no value in the installer debconf database, set the default one.
+		# Useful if modular main server installation has been used (no desktop).
+		value="$mydesktop"
+	fi
+
+	# Using desktop= as kernel argument work, while tasksel/desktop=
+	# do not.  No idea why, but lets use the one that work.
+	if [ "tasksel/desktop" = $template ] ; then template=desktop ; desktop=$value; fi
+
+	# Map the long name to the short alias, to keep the argument list
+	# shorter.
+	if [ "debian-installer/locale" = $template ] ; then template=locale; fi
+	if [ "keyboard-configuration/xkb-keymap" = $template ] ; then template=keymap; fi
+
+	if [ "$value" ] ; then
 	installconfig="$installconfig $template=$value"
-    fi
+	fi
 done
 
-tftpdir=/var/lib/tftpboot
+tftpdir=/srv/tftp
 
 # Where to find the preseed file on the web
 preseedurl=http://www/debian-edu-install.dat
@@ -115,76 +110,88 @@ preseedurl=http://www/debian-edu-install.dat
 # Where the preseed file is on the disk.
 preseedfile=/etc/debian-edu/www/debian-edu-install.dat
 
-# Start from a clean state if run after LTSP chroot arch changes.
-if [ -d $tftpdir/debian-edu ] ; then
-    rm -rf $tftpdir/debian-edu
+# Start from a clean state after any configuration changes have been made.
+if [ -d $tftpdir/ltsp ] ; then
+	rm -rf $tftpdir/debian-edu
+	rm -rf $tftpdir/debian-installer
+	rm -f $tftpdir/ltsp/ltsp.ipxe
+	# re-generate clean ipxe menu file in case of LTSP client support.
+	if [ -d /srv/ltsp/images ] ; then
+		ltsp ipxe
+		# adjust ipxe menue for Debian Edu use.
+		sed -i 's#ltsp/ltsp.img#ltsp/${img}/ltsp.img#' /srv/tftp/ltsp/ltsp.ipxe
+	fi
 fi
 
 [ -d $tftpdir ] || mkdir $tftpdir
 [ -d $tftpdir/debian-edu ] || mkdir $tftpdir/debian-edu
 
 for arch in $archs ; do
-    (
-        if [ true = "$dailydi" ] ; then
-            diurl=https://d-i.debian.org/daily-images/$arch/daily/netboot
-        else
-            diurl=$mirrorurl/dists/$dist/main/installer-$arch/current/images/netboot
-        fi
-	[ -d $tftpdir/debian-installer ] || \
-	    mkdir $tftpdir/debian-installer
-        cd $tftpdir/debian-installer
-	di_ver=10
-        tarball=""
-        if [ -d /usr/lib/debian-installer/images/$di_ver/$arch ]; then
-	    di_img_dir="/usr/lib/debian-installer/images/$di_ver/$arch"
-	    # Use the debian/installer netboot debs
-            tarball=""
-	    if [ true = "$graphicdi" ]; then
-		ln -sf $di_img_dir/gtk/debian-installer/$arch $arch
-	    else
-		ln -sf $di_img_dir/text/debian-installer/$arch $arch
-	    fi
-        elif [ ! -f netboot-$arch.tar.gz ] ; then
-	    if [ true = "$graphicdi" ]; then
-                # Use this URL for graphical installer, and fix
-                # gtkvideo setting below
-                url=$diurl/gtk/netboot.tar.gz
-            else
-                url=$diurl/netboot.tar.gz
-            fi
-            echo "Fetching $url"
-            if wget -q -O netboot-$arch.tar.gz.new $url ; then
-                mv netboot-$arch.tar.gz.new netboot-$arch.tar.gz
-                tarball=netboot-$arch.tar.gz
-            else
-                echo "error: Unable to download $url"
-                exit 1
-            fi
-        fi
-        if [ "$tarball" ] ; then
-            tar --strip-components=2 -zxvf $tarball
-        fi
-        if [ true = "$graphicdi" ]; then
-            # Replace Debian installer logo with Debian Edu one.
-            TMP=$(mktemp -d)
-            mkdir $TMP/$arch
-            cd $TMP/$arch
-            mkdir new
-            cd new
-            unmkinitramfs /var/lib/tftpboot/debian-installer/$arch/initrd.gz .
-            cp /usr/share/pixmaps/debian-edu-$dist-installer-logo.png usr/share/graphics/logo_debian.png
-            find . | cpio -H newc -o > ../initrd
-            cd ..
-            gzip initrd
-            cp initrd.gz /var/lib/tftpboot/debian-installer/$arch
-            rm -rf $TMP/$arch
-        fi
-    )
+	(
+		if [ true = "$dailydi" ] ; then
+			diurl=https://d-i.debian.org/daily-images/$arch/daily/netboot
+		else
+			diurl=$mirrorurl/dists/$dist/main/installer-$arch/current/images/netboot
+		fi
+		[ -d $tftpdir/debian-installer ] || \
+		mkdir $tftpdir/debian-installer
+		cd $tftpdir/debian-installer
+		di_ver=11
+		tarball=""
+		if [ -d /usr/lib/debian-installer/images/$di_ver/$arch ]; then
+			di_img_dir="/usr/lib/debian-installer/images/$di_ver/$arch"
+			# Use the debian/installer netboot debs
+			tarball=""
+			if [ true = "$graphicdi" ]; then
+				ln -sf $di_img_dir/gtk/debian-installer/$arch $arch
+			else
+				ln -sf $di_img_dir/text/debian-installer/$arch $arch
+			fi
+		elif [ ! -f netboot-$arch.tar.gz ] ; then
+			if [ true = "$graphicdi" ]; then
+				# Use this URL for graphical installer, and fix
+				# gtkvideo setting below
+				url=$diurl/gtk/netboot.tar.gz
+			else
+				url=$diurl/netboot.tar.gz
+			fi
+			echo "Fetching $url"
+			if wget -q -O netboot-$arch.tar.gz.new $url ; then
+				mv netboot-$arch.tar.gz.new netboot-$arch.tar.gz
+				tarball=netboot-$arch.tar.gz
+			else
+				echo "error: Unable to download $url"
+				exit 1
+			fi
+		fi
+		if [ "$tarball" ] ; then
+			tar --strip-components=2 -zxvf $tarball
+		fi
+		if [ true = "$graphicdi" ]; then
+			# Replace Debian installer logo with Debian Edu one.
+			TMP=$(mktemp -d)
+			mkdir $TMP/$arch
+			cd $TMP/$arch
+			mkdir new
+			cd new
+			unmkinitramfs $tftpdir/debian-installer/$arch/initrd.gz .
+			if grep -q sid /etc/debian_version ; then
+				cp /usr/share/pixmaps/debian-edu-buster-installer-logo.png usr/share/graphics/logo_debian.png
+			else
+				cp /usr/share/pixmaps/debian-edu-$dist-installer-logo.png usr/share/graphics/logo_debian.png
+			fi
+			find . | cpio -H newc -o > ../initrd
+			cd ..
+			gzip initrd
+			cp initrd.gz $tftpdir/debian-installer/$arch
+			rm -rf $TMP
+		fi
+	)
 done
 
 echo "Generating $preseedfile"
 (
-    cat <<EOF
+	cat <<EOF
 # Enable the Debian Edu installer overrides
 d-i     anna/choose_modules     multiselect     debian-edu-install-udeb: Execute Debian-Edu debian-installer profile
 
@@ -199,7 +206,7 @@ d-i     mirror/http/proxy       string  $http_proxy
 d-i     mirror/ftp/proxy        string  $ftp_proxy
 
 # list extra packages to install here
-#d-i     pkgsel/include string acroread
+#d-i     pkgsel/include string <pkg_name>
 
 # if you want popcon enabled by default
 #d-i     debian-edu-install/participate-popcon boolean true
@@ -213,10 +220,6 @@ d-i     mirror/ftp/proxy        string  $ftp_proxy
 # If you want to avoid the password question
 #d-i passwd/root-password-crypted password passwordhash
 
-# Tell LTSP to not use the CDROM, but a HTTP mirror
-d-i ltsp-client-builder/use_cdrom boolean false
-d-i ltsp-client-builder/build-client-opts string --mirror $mirrorurl --dist $dist
-
 # Tell PXE clients to fetch the correct time from the central NTP server
 # d-i is unable to discover the ntp-server DHCP option.  Hardcode
 # setting here instead.  FIXME: Remove when #714288 in netcfg is fixed.
@@ -224,12 +227,12 @@ d-i netcfg/dhcp_ntp_servers string ntp
 
 # Pass on the time zone used on the main-server
 EOF
-    debconf-get-selections --installer | grep -w 'time/zone'
+	debconf-get-selections --installer | grep -w 'time/zone'
 
-    # No use copying the installation mirror setting if a DVD or USB
-    # stick was used.
-    if grep -qi 'dvd|bd' /etc/apt/sources.list ; then
-cat <<EOF
+	# No use copying the installation mirror setting if a DVD or USB
+	# stick was used.
+	if grep -qi 'dvd|bd' /etc/apt/sources.list ; then
+		cat <<EOF
 
 # Avoid questions about mirrors, using manual setup
 choose-mirror-bin     mirror/country          string  manual
@@ -238,143 +241,124 @@ choose-mirror-bin     mirror/http/mirror      select
 choose-mirror-bin     mirror/http/hostname    string  deb.debian.org
 choose-mirror-bin     mirror/http/directory   string  /debian
 EOF
-    else
+	else
 	debconf-get-selections --installer | egrep -w 'mirror/http/mirror|mirror/country|mirror/protocol|mirror/http/hostname|mirror/http/directory|mirror/ftp/hostname|mirror/ftp/directory' | sort
-    fi
+	fi
 
-    # Make it easier to have local overrides and still be able to
-    # rerun debian-edu-pxeinstall.
-    if [ -f $preseedfile.local ] ; then
-	cat $preseedfile.local
-    fi
+	# Make it easier to have local overrides and still be able to
+	# rerun debian-edu-pxeinstall.
+	if [ -f $preseedfile.local ] ; then
+		cat $preseedfile.local
+	fi
 ) > $preseedfile
 
-if [ "$passwdmd5hash" ]; then
-    cat <<EOF > $tftpdir/debian-edu/menupasswd.cfg
-        MENU PASSWD $passwdmd5hash
-EOF
-fi
-
 menufile=$tftpdir/debian-edu/install.cfg
 echo "Generating $menufile"
 (
-    if [ true = "$graphicdi" ]; then
-        gtkvideo="vga=788"
-    fi
-    for arch in $archs ; do
-        cat <<EOF
-	# Based on the values used in Debian, and added the preseed URL
-LABEL neteduboot-$arch
-        MENU LABEL Install Edu/^$arch ($desktop)
-        kernel debian-installer/$arch/linux
-        append $gtkvideo initrd=debian-installer/$arch/initrd.gz auto url=$preseedurl hostname=$hostname domain=$domain $installconfig --- quiet
-	ipappend 2
-include menupassword.cfg
-
+	if [ true = "$graphicdi" ]; then
+		gtkvideo="vga=788"
+	fi
+	for arch in $archs ; do
+		cat <<EOF
+
+# Based upon locale, keymap and desktop values used during main-server installation; auto URL added.
+:$arch
+set params auto url=http://www/debian-edu-install.dat hostname=$hostname domain=$domain $installconfig $gtkvideo --- quiet ipappend 2
+kernel /debian-installer/$arch/linux initrd=initrd.gz \${params}
+initrd /debian-installer/$arch/initrd.gz
+boot || goto failed
 EOF
-    done
+	done
 ) > $menufile
 
-memtest=
-if [ -f /boot/memtest86.bin ] ; then
-    memtest=/boot/memtest86.bin
-fi
-if [ -f /boot/memtest86+.bin ] ; then
-    memtest=/boot/memtest86+.bin
-fi
-if [ "$memtest" ] ; then
-    cp $memtest $tftpdir/debian-edu/memtest86
-    cat <<EOF > $tftpdir/debian-edu/memtest.cfg
-LABEL memtest86
-        MENU    LABEL  Test ^memory
-        kernel  debian-edu/memtest86
-
-EOF
+if grep -q sid /etc/debian_version ; then
+	cp /usr/share/pixmaps/debian-edu-buster-syslinux.png $tftpdir/debian-edu/debian-edu-pxe.png
+else
+	cp /usr/share/pixmaps/debian-edu-$dist-syslinux.png $tftpdir/debian-edu/debian-edu-pxe.png
 fi
 
-if [ -d /var/lib/tftpboot/ltsp/$ltsparch ] ; then
-    ltsproot=/opt/ltsp/$ltsparch
-
-    cat <<EOF > $tftpdir/debian-edu/ltsp-thin.cfg
-
-LABEL ltsp-thin
-        MENU    LABEL  LTSP ^thin client
-        KERNEL ltsp/$ltsparch/vmlinuz
-        APPEND initrd=ltsp/$ltsparch/initrd.img init=/sbin/init-ltsp root=/dev/$rootdev ro LTSP_FATCLIENT=False quiet
-	IPAPPEND 2
-EOF
-    cat > $tftpdir/debian-edu/default-thin.cfg <<EOF
-DEFAULT ltsp/$ltsparch/vmlinuz initrd=ltsp/$ltsparch/initrd.img init=/sbin/init-ltsp root=/dev/$rootdev ro LTSP_FATCLIENT=False quiet ipappend 2
-
-EOF
-
-# See if LTSP also have diskless workstation support
-    if [ -e $ltsproot/lib/x86_64-linux-gnu/security/pam_krb5.so -a "amd64" = $ltsparch ] || \
-       [ -e $ltsproot/lib/x86_64-linux-gnu/security/pam_ldap.so -a "amd64" = $ltsparch ] || \
-       [ -e $ltsproot/lib/x86_64-linux-gnu/security/pam_sss.so -a "amd64" = $ltsparch ] || \
-       [ -e $ltsproot/lib/i386-linux-gnu/security/pam_krb5.so -a "i386" = $ltsparch ] || \
-       [ -e $ltsproot/lib/i386-linux-gnu/security/pam_ldap.so -a "i386" = $ltsparch ] || \
-       [ -e $ltsproot/lib/i386-linux-gnu/security/pam_sss.so -a "i386" = $ltsparch ] ; then
-	cat <<EOF > $tftpdir/debian-edu/ltsp-diskless.cfg
-
-LABEL ltsp-diskless
-        MENU    LABEL  LTSP ^diskless workstation
-        KERNEL ltsp/$ltsparch/vmlinuz
-        APPEND initrd=ltsp/$ltsparch/initrd.img init=/sbin/init-ltsp root=/dev/$rootdev ro quiet
-	IPAPPEND 2
-
-EOF
-	cat > $tftpdir/debian-edu/default-diskless.cfg <<EOF
-DEFAULT ltsp/$ltsparch/vmlinuz initrd=ltsp/$ltsparch/initrd.img init=/sbin/init-ltsp root=/dev/$rootdev ro quiet ipappend 2
+# Generate/modify the iPXE menu file
+if [ -f $tftpdir/ltsp/ltsp.ipxe ] ; then
+	# ltsp is installed already, modify existing ipxe menu
+	if ! grep -q main-server $tftpdir/ltsp/ltsp.ipxe ; then
+	echo "Modifying $tftpdir/ltsp/ltsp.ipxe"
+	sed -i '/^menu.*/ a item\
+item --gap                        Installation:\
+item --key a amd64                Install Debian Edu/amd64 (64-Bit)\
+item --key i i386                 Install Debian Edu/i386  (32-Bit)\
+item\
+' /srv/tftp/ltsp/ltsp.ipxe
+	cat $menufile >> $tftpdir/ltsp/ltsp.ipxe
+	fi
+else
+	# generate ipxe menu on a plain main server for PXE installations
+	mkdir -p $tftpdir/ltsp/
+	cp /usr/lib/ipxe/undionly.kpxe $tftpdir/ltsp/
+	cp /usr/lib/ipxe/snponly.efi $tftpdir/ltsp/
+	cp /boot/memtest86+.bin $tftpdir/ltsp/
+	echo "Generating $tftpdir/ltsp/ltsp.ipxe"
+	cat <<EOF > /srv/tftp/ltsp/ltsp.ipxe
+#!ipxe
+#
+# Configure iPXE for network installations
+
+# Set the default image (img) based on arch, or to root-path if it's not empty
+cpuid --ext 29 && set img amd64 || set img i386
+
+goto start
+
+:start
+# To completely hide the menu, set menu-timeout to -1
+isset \${menu-timeout} || set menu-timeout 5000
+iseq "\${menu-timeout}" "-1" && goto \${img} ||
+menu Debian Edu iPXE boot menu || goto \${img}
+item
+item --gap                        Debian Edu installation:
+item --key a amd64                Install Debian Edu/amd64 (64-Bit)
+item --key i i386                 Install Debian Edu/i386  (32-Bit)
+item
+item --gap                        Other options:
+item --key m memtest              Memory test
+item --key c config               Enter iPXE configuration
+item --key s shell                Drop to iPXE shell
+item --key d disk                 Boot from the first local disk
+item
+item --key x exit                 Exit iPXE and continue BIOS boot
+choose --timeout \${menu-timeout} --default \${img} img || goto cancel
+goto \${img}
+
+:memtest
+iseq \${platform} pcbios && kernel memtest86+.bin || kernel memtest.efi
+# Boot "fails" on normal memtest exit with Esc, so show the menu again
+boot ||
+goto start
+
+:config
+config
+goto start
+
+:shell
+echo Type 'exit' to get the back to the menu
+shell
+goto start
+
+:disk
+# Boot the first local HDD
+sanboot --no-describe --drive 0x80 || goto failed
+
+:exit
+exit 1
+
+:cancel
+echo You cancelled the menu, dropping to a shell
+goto shell
+
+:failed
+echo Booting failed, dropping to a shell
+goto shell
 EOF
-    fi
+	if ! grep -q main-server $tftpdir/ltsp/ltsp.ipxe ; then
+		cat $menufile >> $tftpdir/ltsp/ltsp.ipxe
+	fi
 fi
 
-cat <<EOF > $tftpdir/debian-edu/localboot.cfg
-LABEL localboot
-        MENU LABEL Boot from ^local harddrive
-        MENU DEFAULT
-        localboot 0
-
-EOF
-
-ln -sf /usr/lib/PXELINUX/pxelinux.0 $tftpdir/pxelinux.0
-ln -sf /usr/lib/syslinux/modules/bios $tftpdir/syslinux
-ln -sf /usr/share/pixmaps/debian-edu-$dist-syslinux.png $tftpdir/debian-edu/debian-edu-pxe.png
-
-defaultfile=$tftpdir/debian-edu/default-menu.cfg
-echo "Generating $defaultfile"
-(
-    cat <<EOF
-include debian-edu/localboot.cfg
-MENU SEPARATOR
-include debian-edu/ltsp-diskless.cfg
-include debian-edu/ltsp-thin.cfg
-MENU SEPARATOR
-include debian-edu/install.cfg
-MENU SEPARATOR
-include debian-edu/memtest.cfg
-
-menu color title        * #FFFFFFFF *
-menu color border       * #00000000 #00000000 none
-menu color sel          * #ffffffff #76a1d0ff *
-menu color hotsel       1;7;37;40 #ffffffff #76a1d0ff *
-menu color tabmsg       * #ffffffff #00000000 *
-menu color help         37;40 #ffdddd00 #00000000 none
-
-menu vshift 4
-menu rows 10
-menu hshift 13
-menu width 49
-menu background debian-edu/debian-edu-pxe.png
-menu tabmsg Press ENTER to boot or TAB to edit a menu entry
-default vesamenu.c32
-prompt 0
-timeout 0
-EOF
-) > $defaultfile
-
-# Use the complete menu by default
-pxecfgdir=$tftpdir/pxelinux.cfg
-[ -d  $pxecfgdir ] || mkdir $pxecfgdir
-ln -sf ../debian-edu/default-menu.cfg $pxecfgdir/default



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/168da2151903d78ef80cb0703c4633d7fe034158

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/168da2151903d78ef80cb0703c4633d7fe034158
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20200315/27928a41/attachment-0001.html>


More information about the debian-edu-commits mailing list