[debian-edu-commits] [Git][debian-edu/debian-edu-config][personal/sunweaver/debian-edu-pxeinstall-multiple-version-support] 5 commits: bin/debian-edu-ldapserver: Don't use $ldapserver uninitialised.
Daniel Teichmann (@dzatoah)
gitlab at salsa.debian.org
Wed Sep 23 16:21:17 BST 2026
Daniel Teichmann pushed to branch personal/sunweaver/debian-edu-pxeinstall-multiple-version-support at Debian Edu / debian-edu-config
Commits:
b89ecda1 by Mike Gabriel at 2026-09-15T21:56:17+02:00
bin/debian-edu-ldapserver: Don't use $ldapserver uninitialised.
- - - - -
d07a5844 by Mike Gabriel at 2026-09-23T17:21:10+02:00
debian-edu-pxeinstall: When downloading the netinstaller, skip if download fails. (Closes: #1147699).
- - - - -
5d38eabf by Mike Gabriel at 2026-09-23T17:21:10+02:00
debian-edu-pxeinstall: Support multiple D-I versions if installed as DEB. (Closes: #1147764).
- - - - -
8c269ee1 by Mike Gabriel at 2026-09-23T17:21:10+02:00
debian-edu-pxeinstall: Default to amd64 only, since trixie there is no i386 Debian-Installer anymore.
- - - - -
124fc1dd by Mike Gabriel at 2026-09-23T17:21:10+02:00
tools/pxe-addfirmware: Refactor script. Adjust for trixie and for multi-version netboot D-I.
- - - - -
4 changed files:
- bin/debian-edu-ldapserver
- etc/debian-edu/pxeinstall.conf
- sbin/debian-edu-pxeinstall
- share/debian-edu-config/tools/pxe-addfirmware
Changes:
=====================================
bin/debian-edu-ldapserver
=====================================
@@ -63,7 +63,7 @@ if (on_main_server() && during_installation()) {
print STDERR "warning: no DNS name from dnsdomainname call. using $dnsdomain from /etc/resolv.conf.\n" if $opts{d};
}
$ldapserver = $opts{s} || find_ldap_server($dnsdomain);
- print STDERR "info: found ldap server $ldapserver\n" if $opts{d};
+ print STDERR "info: found ldap server $ldapserver\n" if $opts{d} && $ldapserver;
$krbserver = find_kerberos_server($dnsdomain);
}
}
=====================================
etc/debian-edu/pxeinstall.conf
=====================================
@@ -13,3 +13,6 @@ graphicdi=true
# Set this during development to test if daily d-i netboot.tar.gz is working.
#dailydi=true
+
+# Architectures to support by Debian-Installer via PXE boot.
+#archs=amd64
=====================================
sbin/debian-edu-pxeinstall
=====================================
@@ -52,14 +52,16 @@ fi
# Grab dist value for both testing and stable release cases.
if grep -q / /etc/debian_version ; then
- dist=$(cat /etc/debian_version | cut -d/ -f1)
+ dist_codename=$(cat /etc/debian_version | cut -d/ -f1)
+ dist_version=${dist}
else
- dist=$(lsb_release -sc)
+ dist_codename=$(lsb_release -sc)
+ dist_version=$(lsb_release -sr)
fi
default_mydesktop="xfce"
-[ "$archs" ] || archs="amd64 i386"
+[ "$archs" ] || archs="amd64"
[ "$mirrorurl" ] || mirrorurl=http://deb.debian.org/debian
[ "$hostname" ] || hostname=pxeinstall
[ "$domain" ] || domain=intern
@@ -136,28 +138,50 @@ fi
[ -d $tftpdir ] || mkdir $tftpdir
[ -d $tftpdir/debian-edu ] || mkdir $tftpdir/debian-edu
+[ -d $tftpdir/debian-installer ] || \
+mkdir $tftpdir/debian-installer
+cd $tftpdir/debian-installer
+
+# We require to have at least debian-installer-<dist_version>-netboot-* installed,
+# if not, we fallback to http download from Debian archive servers
+if [ -d "/usr/lib/debian-installer/images/${dist_version}" ]; then
+ di_versions_supported="$(cd /usr/lib/debian-installer/images/; ls -1 | grep -E '^[0-9]+$' | sort -r -h)"
+else
+ di_versions_supported="${dist_version}"
+fi
+
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
+ for di_ver in ${di_versions_supported}; do
+ (
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
- cp -r -u $di_img_dir/gtk/debian-installer/$arch $arch
+ if [ -d /usr/lib/debian-installer/images/ ]; then
+ di_img_dir="/usr/lib/debian-installer/images/${di_ver}/${arch}"
+ if [ -d ${di_img_dir} ]; then
+ # Use the debian/installer netboot debs
+ mkdir -p ${di_ver}/
+ if [ true = "$graphicdi" ]; then
+ cp -r -u ${di_img_dir}/gtk/debian-installer/${arch} ${di_ver}/
+ else
+ cp -r -u ${di_img_dir}/text/debian-installer/${arch} ${di_ver}/
+ fi
+ else
+ continue
+ fi
+ elif [ ! -f ${dist_version}/netboot-$arch.tar.gz ] ; then
+
+ # Daily DI vs. released netboot images
+ if [ true = "$dailydi" ] ; then
+ diurl=https://d-i.debian.org/daily-images/$arch/daily/netboot
else
- cp -r -u $di_img_dir/text/debian-installer/$arch $arch
+ diurl=${mirrorurl}/dists/${dist_codename}/main/installer-${arch}/current/images/netboot
fi
- elif [ ! -f netboot-$arch.tar.gz ] ; then
+
+ # Only support D-I version of the server's distro version
+ di_ver=${dist_version}
+
+ # This only supports Debian Installer netboot setup for the same version as this server.
if [ true = "$graphicdi" ]; then
# Use this URL for graphical installer, and fix
# gtkvideo setting below
@@ -166,16 +190,24 @@ for arch in $archs ; do
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
+ set +e
+ if wget -q -O netboot-$arch.tar.gz.new $url; then
+ mkdir -p ${di_ver}/
+ cd ${di_ver}
+ mv ../netboot-$arch.tar.gz.new netboot-$arch.tar.gz
tarball=netboot-$arch.tar.gz
else
- echo "error: Unable to download $url"
- exit 1
+ echo "warning: Unable to download $url"
+ # remove cruft
+ rm -f netboot-$arch.tar.gz.new
+ continue
fi
+ set -e
fi
if [ "$tarball" ] ; then
tar --strip-components=2 -zxvf $tarball
+ # remove downloaded netboot installer tarball
+ rm $tarball
fi
if [ true = "$graphicdi" ]; then
# Replace Debian installer logo with Debian Edu one.
@@ -184,17 +216,18 @@ for arch in $archs ; do
cd $TMP/$arch
mkdir new
cd new
- unmkinitramfs $tftpdir/debian-installer/$arch/initrd.gz .
+ unmkinitramfs ${tftpdir}/debian-installer/${di_ver}/${arch}/initrd.gz .
if [ ! -z "$theme" ] ; then
cp /usr/share/pixmaps/$theme-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
+ cp initrd.gz ${tftpdir}/debian-installer/${di_ver}/${arch}/
rm -rf $TMP
fi
- )
+ )
+ done
done
echo "Generating $preseedfile"
@@ -267,15 +300,19 @@ echo "Generating $menufile"
gtkvideo="vga=788"
fi
for arch in $archs ; do
- cat <<EOF
+ for di_ver in ${di_versions_supported}; do
+ if [ -d "${tftpdir}/debian-installer/${di_ver}/${arch}" ]; then
+ cat <<EOF
# Based upon locale, keymap and desktop values used during main-server installation; auto URL added.
-:$arch
+:${arch}_${dist_version}
set params auto url=http://www/debian-edu-install.dat hostname=$hostname domain=$domain $installconfig $gtkvideo --- quiet
-kernel /debian-installer/$arch/linux initrd=initrd.gz \${params}
-initrd /debian-installer/$arch/initrd.gz
+kernel /debian-installer/${di_ver}/${arch}/linux initrd=initrd.gz \${params}
+initrd /debian-installer/${di_ver}/${arch}/initrd.gz
boot || goto failed
EOF
+ fi
+ done
done
) > $menufile
@@ -287,14 +324,19 @@ fi
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\
+ echo "Modifying $tftpdir/ltsp/ltsp.ipxe"
+
+ # FIXME: also support other installer versions here, currently only latest version gets
+ # integrated into LTSP servers ltsp.ipxe file.
+
+ 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 --key a amd64_${dist_version} Install Debian Edu ${dist_version} / amd64 (64-Bit)\
+# BEGIN: Debian-Installer other versions
+# END: Debian-Installer other versions
item\
-' /srv/tftp/ltsp/ltsp.ipxe
- cat $menufile >> $tftpdir/ltsp/ltsp.ipxe
+" ${tftpdir}/ltsp/ltsp.ipxe
+ cat $menufile >> $tftpdir/ltsp/ltsp.ipxe
fi
else
# generate ipxe menu on a plain main server for PXE installations
@@ -304,13 +346,13 @@ else
cp /boot/memtest86+ia32.bin $tftpdir/ltsp/memtest.0
cp /boot/memtest86+x64.efi $tftpdir/ltsp/memtest.efi
echo "Generating $tftpdir/ltsp/ltsp.ipxe"
- cat <<EOF > /srv/tftp/ltsp/ltsp.ipxe
+ cat <<EOF > ${tftpdir}/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
+cpuid --ext 29 && set img amd64_${dist_version} || set img i386_${dist_version}
goto start
@@ -321,8 +363,9 @@ 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 --key a amd64_${dist_version} Install Debian Edu ${dist_version} / amd64
+# BEGIN: Debian-Installer other versions
+# END: Debian-Installer other versions
item
item --gap Other options:
item --key m memtest Memory test
@@ -369,3 +412,23 @@ EOF
fi
fi
+# Insert other Debian-Installer versions, if any.
+if [ "${dist_version}" != "${di_versions_supported}" ]; then
+ # We have more D-I netboot versions installed, so inject them into the iPXE boot menu
+ for di_ver in ${di_versions_supported}; do
+ for arch in ${archs}; do
+ if [ "${di_ver}" = "${dist_version}" ]; then
+ # we already have this, see above
+ :
+ else
+ if [ -d $tftpdir/debian-installer/${di_ver}/${arch} ]; then
+ sed -i "/^# END: Debian-Installer other versions/i \
+item ${arch}_${di_ver} Install Debian Edu ${di_ver} / ${arch}\
+" ${tftpdir}/ltsp/ltsp.ipxe
+ fi
+ fi
+ done
+ done
+else
+ sed -E -i "${tftpdir}/ltsp/ltsp.ipxe" -e "/# (BEGIN|END): Debian-Installer other versions/d"
+fi
=====================================
share/debian-edu-config/tools/pxe-addfirmware
=====================================
@@ -1,74 +1,100 @@
#!/bin/sh
#
-# Adds (non-free) firmware to the debian-installer initrd used by the
+# Adds (non-free-firmware) firmware to the debian-installer initrd used by the
# PXE installation to make sure it works on more hardware out of the
# box.
set -e
-add_firmware_to_initrd() {
- initrd=$1
+export TMPDIR=/var/tmp
- tmpdir=$(mktemp -d)
- cd $tmpdir
+echo Finding and downloading firmware .debs
+# Find files. This requires non-free-firmware to be enabled as APT
+# repository.
+# Skip installer debs to avoid the b43 installers that conflict
+# with each other.
+# For bookworm, also exclude firmware-microbit-micropython{-dl}.
+# For trixie, exclude various other 'huge' firmware packages and metadata packages.
+# FIXME Review if this needs to be adjusted after trixie.
+debnames="$(apt-cache search ^firmware-.* | grep -v installer \
+ | grep -v firmware-micropython \
+ | grep -v firmware-nvidia \
+ | grep -v firmware-qcom \
+ | grep -v firmware-marvell-prestera \
+ | grep -v firmware-linux-nonfree \
+ | grep -v firmware-linux \
+ | grep -v fxload \
+ | grep -v dfu-util \
+ | grep -v ap51-flash \
+ | cut -d" " -f1)"
- echo Finding and downloading firmware .debs
- # Find files. This requires non-free to be enabled as APT
- # repository.
- # Skip installer debs to avoid the b43 installers that conflict
- # with each other.
- # For bookworm, also exclude firmware-microbit-micropython{-dl}.
- # FIXME Review if this is still needed after bookworm.
- debnames="$(apt-cache search ^firmware-.* | grep -v installer | grep -v micropython | cut -d" " -f1)"
+# Allow caller to ask for extra debs using environment variable
+debnames="$debnames $FIRMWAREDEBNAMES"
- # Allow caller to ask for extra debs using environment variable
- debnames="$debnames $FIRMWAREDEBNAMES"
+add_firmware_to_initrd() {
+ initrd=$1
- apt-get --download-only -y -q install $debnames
+ tmpdir=$(mktemp -d)
+ cd $tmpdir
- # Find firmware .deb files
- for name in $debnames ; do
- for deb in /var/cache/apt/archives/${name}_* ; do
- if [ -f $deb ] ; then
- debs="$debs $deb"
- fi
+ # Find firmware .deb files
+ for name in $debnames ; do
+ for deb in /var/cache/apt/archives/${name}_* ; do
+ if [ -f $deb ] ; then
+ debs="$debs $deb"
+ fi
+ done
done
- done
- echo Unpacking current initrd
- gunzip < $initrd | cpio --quiet -id
+ echo Unpacking current initrd
+ gunzip < $initrd | cpio --quiet -id
- echo Unpacking firmware files, overwriting any in the original initrd
- for deb in $debs ; do
- if ar p $deb data.tar.gz | tar zxf - ./lib/firmware/ >/dev/null 2>&1 ; then
- :
- else
- echo "Ignoring $deb without /lib/firmware/"
- fi
- done
+ echo Unpacking firmware files, overwriting any in the original initrd
+ for deb in $debs ; do
+ data_tarball="$(ar t $deb | grep data.tar.)"
+ if ar p ${deb} ${data_tarball} > ${data_tarball} && tar axf ${data_tarball} ./usr/lib/firmware ; then
+ :
+ # and clean up...
+ rm ${data_tarball}
+ else
+ echo "Ignoring $deb without /usr/lib/firmware/"
+ fi
+ done
- timestamp=$(date +%Y%m%dT%H:%M)
- echo Wrapping up new initrd
- find . | cpio --quiet -o -H newc | gzip -9 > $initrd.new &&
- mv $initrd $initrd.old-$timestamp &&
- mv $initrd.new $initrd
- cd /
- rm -rf $tmpdir
+ timestamp=$(date +%Y%m%dT%H:%M)
+ echo Wrapping up new initrd
+ echo $(pwd)
+ echo ${initrd}.new
+ find . | cpio --quiet -o -H newc | gzip -9 > $initrd.new &&
+ mv $initrd $initrd.old-$timestamp &&
+ mv $initrd.new $initrd
+ cd /
+ rm -rf $tmpdir
}
if [ "$1" ] ; then
- diroot="$1"
+ diroot="$1"
fi
# Path to where the d-i pxe boot images were unpacked
if [ -z "$diroot" ] ; then
- diroot=/srv/tftp/debian-installer
+ diroot=/srv/tftp/debian-installer
fi
-for initrd in $diroot/*/initrd.gz ; do
- if [ -e $initrd ] ; then
- add_firmware_to_initrd "$initrd"
- else
- echo "Unable to open $initrd"
- fi
+# Retrieve .deb packages that we will extract firmware files from.
+apt-get --download-only --no-install-recommends -y -q install $debnames
+
+# We will use firmware files available for this host's Debian version for
+# all Debian-Installer initrd files (also for older/newer D-I versions).
+# For older D-I versions, this will likely work well.
+# FIXME: For newer D-I versions, we need to find a better solution at some point
+# (e.g. debootstrap a minimal system based on the D-I version and obtain the
+# firmware files into that chroot, FTR: firmware packages are arch:all, so only
+# one amd64 chroot for Debian version based downloads are sufficient).
+for initrd in $diroot/*/*/initrd.gz ; do
+ if [ -e $initrd ] ; then
+ add_firmware_to_initrd "$initrd"
+ else
+ echo "Unable to open $initrd"
+ fi
done
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/2dcd8064c99e2d618357d61024383a194e00ab60...124fc1dd85304aa55591b90a7e5feb752f64a030
--
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/2dcd8064c99e2d618357d61024383a194e00ab60...124fc1dd85304aa55591b90a7e5feb752f64a030
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20260923/c8ed33cf/attachment-0001.htm>
More information about the debian-edu-commits
mailing list