[debian-edu-commits] [Git][debian-edu/debian-edu-config][personal/sunweaver/debian-edu-ltsp-install-refactoring] sbin/debian-edu-ltsp-install: Refactor LTSP chroot/image creation.

Mike Gabriel (@sunweaver) gitlab at salsa.debian.org
Thu Oct 15 11:51:00 BST 2026



Mike Gabriel pushed to branch personal/sunweaver/debian-edu-ltsp-install-refactoring at Debian Edu / debian-edu-config


Commits:
882a5130 by Mike Gabriel at 2026-10-15T12:50:43+02:00
sbin/debian-edu-ltsp-install: Refactor LTSP chroot/image creation.

- - - - -


17 changed files:

- Makefile
- + lib/debian-edu-config/ltsp-install.d/ltsp-variant_dlwchroot
- + lib/debian-edu-config/ltsp-install.d/ltsp-variant_dlwltsphost
- + lib/debian-edu-config/ltsp-install.d/ltsp-variant_x2godisplaymanager
- + lib/debian-edu-config/ltsp-install.d/ltsp-variant_x2gominidesktop
- + lib/debian-edu-config/ltsp-postinst.d/90_common_apt-sources.sh
- + lib/debian-edu-config/ltsp-preinst.d/09_common_x2go-autodetect-desktop.sh
- + lib/debian-edu-config/ltsp-preinst.d/10_x2godisplaymanager_x2goclient-setup.sh
- + lib/debian-edu-config/ltsp-preinst.d/10_x2gominidesktop_x2goclient-setup.sh
- + lib/debian-edu-config/ltsp-preinst.d/20_common_apt-sources.sh
- + lib/debian-edu-config/ltsp-preinst.d/90_common_ltsp-setup.sh
- + lib/debian-edu-config/ltsp-vars.d/10_common_vars.sh
- + lib/debian-edu-config/ltsp-vars.d/20_dlwchroot_vars.sh
- + lib/debian-edu-config/ltsp-vars.d/20_x2godisplaymanager_vars.sh
- + lib/debian-edu-config/ltsp-vars.d/20_x2gominidesktop_vars.sh
- sbin/debian-edu-ltsp-install
- sbin/debian-edu-ltsp-ipxe


Changes:

=====================================
Makefile
=====================================
@@ -230,9 +230,26 @@ WWWFILES = \
 	$(NULL)
 
 LIBFILES = \
+	debian-edu-config/ltsp-vars.d/20_dlwchroot_vars.sh \
+	debian-edu-config/ltsp-vars.d/20_x2godisplaymanager_vars.sh \
+	debian-edu-config/ltsp-vars.d/20_x2gominidesktop_vars.sh \
+	debian-edu-config/ltsp-vars.d/10_common_vars.sh \
+	debian-edu-config/ltsp-preinst.d/20_common_apt-sources.sh \
+	debian-edu-config/ltsp-preinst.d/10_x2godisplaymanager_x2goclient-setup.sh \
+	debian-edu-config/ltsp-preinst.d/10_x2gominidesktop_x2goclient-setup.sh \
+	debian-edu-config/ltsp-preinst.d/09_common_x2go-autodetect-desktop.sh \
+	debian-edu-config/ltsp-preinst.d/90_common_ltsp-setup.sh \
+	debian-edu-config/ltsp-postinst.d/90_common_apt-sources.sh \
 	thunderbird/distribution/policies.json \
 	$(NULL)
 
+LIBSCRIPTS = \
+	debian-edu-config/ltsp-install.d/ltsp-variant_dlwltsphost \
+	debian-edu-config/ltsp-install.d/ltsp-variant_x2gominidesktop \
+	debian-edu-config/ltsp-install.d/ltsp-variant_x2godisplaymanager \
+	debian-edu-config/ltsp-install.d/ltsp-variant_dlwchroot \
+	$(NULL)
+
 all:
 	$(MAKE) -C www
 
@@ -286,6 +303,10 @@ install: install-testsuite
 		$(INSTALL_DATA) lib/$$file $(DESTDIR)$(libdir)/$$file; \
 	done
 
+	set -e ; for file in $(LIBSCRIPTS) ; do \
+		$(INSTALL) lib/$$file $(DESTDIR)$(libdir)/$$file; \
+	done
+
 	set -e ; for f in \
 		share/debian-edu-config/d-i/finish-install \
 		share/debian-edu-config/d-i/pre-pkgsel \


=====================================
lib/debian-edu-config/ltsp-install.d/ltsp-variant_dlwchroot
=====================================
@@ -0,0 +1,155 @@
+#!/bin/bash
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Licence:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+set -e
+
+# Check if this script is sourced or executed directly.
+( return 0 2>/dev/null ) && sourced=true || sourced=false
+
+if [ "${sourced}" = "false" ]; then
+
+	# Initialize required variables from debian-edu-config LTSP installer's vars directory.
+	ltsp_vars_dir="/usr/lib/debian-edu-config/ltsp-vars.d"
+	if [ -n "$(find ${ltsp_vars_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+		for vars_file in "${ltsp_vars_dir}"/[0-9][0-9]_{common,dlwchroot}_*.sh; do
+			source "${vars_file}"
+		done
+	fi
+
+	create_squashfs_image=${create_squashfs_image:-"false"}
+	trap cleanup_debian_edu_ltspinstall_dlwchroot TERM INT EXIT
+else
+	do_install_function="do_debian_edu_ltspinstall_dlwchroot"
+	cleanup_function="cleanup_debian_edu_ltspinstall_dlwchroot"
+fi
+
+function cleanup_debian_edu_ltspinstall_dlwchroot()
+{
+	trap - TERM INT EXIT
+	umount -q ${target}/dev/pts || true
+	umount -q ${target}/proc || true
+	if grep -q BD "/etc/apt/sources.list" && [ -f "/media/cdrom/.disk/info" ] ; then
+		umount "${target}/media/cdrom" || true
+		umount "/media/cdrom" || true
+	fi
+	exit 0
+}
+
+function do_debian_edu_ltspinstall_dlwchroot() {
+
+	# Generate chroot and SquashFS image (optional) for diskless workstation from
+	# scratch via debootstrapping a fresh Debian Edu chroot.
+
+	# The chroot is basically a workstation installation.
+	# Petter Reinholdtsen's debian-edu-bless script is used to achieve it.
+
+	cat <<EOF >> /etc/ltsp/ltsp.conf
+LIGHTDM_CONF="greeter-hide-users"
+POST_INIT_USE_FQDN="sed -i '/10.0.2.2/ s/server/tjener.intern tjener/' /etc/hosts"
+EOF
+
+	if [ "${sourced}" = "false" ] && [ -d "${target}" ]; then
+		echo "ERROR: ${ltspchroot} diskless workstation already created"
+		exit 1
+	elif [ "${sourced}" = "true" ] && [ -d "${target}" ]; then
+		echo "INFO: ${ltspchroot} diskless workstation already created, skipping creation"
+		return 0
+	fi
+
+	ltsp="$(command -v ltsp)"
+	if [ -z "${ltsp}" ]; then
+		echo "ERROR: '${ltsp}' not found, install via \`apt-get install ltsp\`"
+		exit 1
+	fi
+
+	debootstrap="$(command -v debootstrap)"
+	if [ -z "${debootstrap}" ]; then
+		echo "ERROR: '$deboostrap' not found, install via \`apt-get install debootstrap\`"
+		exit 1
+	fi
+
+	mkdir -p  ${target}
+	chmod 755 ${target}
+
+	export DEBIAN_FRONTEND=noninteractive
+
+	# Install base system
+	${debootstrap} --arch="${arch}" --no-check-gpg --variant=minbase --include=locales,console-setup,linux-image-"${arch}" "${dist}" "${target}" "${mirror}"
+
+	# This needs to be set up after debootstrap has run
+	if [ "true" == "${BD_ISO}" ] ; then
+		mkdir -p ${target}/media/cdrom
+		mount /media/cdrom ${target}/media/cdrom -o bind
+		echo "deb [trusted=yes] $mirror $dist main" > ${target}/etc/apt/sources.list
+	fi
+
+	# Care for complete sources list (security, also nonfree -- in case firmware is needed).
+	${do_chroot} sh -c "cp /usr/share/doc/apt/examples/debian.sources /etc/apt/sources.list.d/debian.sources"
+
+	# Care for same locale and keyboard settings in the chroot, also useful to quiet down Perl.
+	cp /etc/locale.gen "${target}/etc/"
+	cp /etc/default/locale "${target}/etc/default"
+	${do_chroot} locale-gen
+	cp /etc/default/keyboard "${target}/etc/default"
+	cp /etc/default/console-setup "${target}/etc/default"
+	${do_chroot} setupcon -k
+
+	# Care for special files.
+	# Unset temporary directory variables to avoid problems when directory
+	# is missing inside the chroot. https://bugs.debian.org/765443
+	unset TMPDIR TEMP TEMPDIR TMP
+	mount /dev/pts -t devpts "${target}/dev/pts"
+	mount proc -t proc "${target}/proc"
+	mkdir -p "${target}/tmp/user/0/"
+	cp /usr/share/debian-edu-config/tools/debian-edu-bless "${target}/sbin"
+
+	# Install apt-utils to not delay package configuration
+	${do_chroot} apt-get install -y -q apt-utils
+
+	# Turn system into a Debian Edu workstation.
+	${do_chroot} sh -c "PROFILE=Workstation DESKTOP=$desktop /sbin/debian-edu-bless"
+	mkdir -p "${target}/skole"
+	chmod 755 "${target}/skole"
+	rm -f "${target}/etc/resolv.conf"
+	# FIXME: Next line needed for kerberized NFS home directory access.
+	#cp /etc/krb5.keytab "${target}/etc/"
+	# Care for Debian Edu certificates.
+	cp /etc/ssl/certs/debian-edu-server.crt "${target}/etc/ssl/certs/"
+	cp /usr/local/share/ca-certificates/*.crt "${target}/usr/local/share/ca-certificates/"
+	${do_chroot} update-ca-certificates
+	# Adjust Sitesummary configuration
+	cp -f /etc/sitesummary/site "${target}/etc/sitesummary/"
+	cp -f /etc/sitesummary/sitegroup "${target}/etc/sitesummary/"
+	echo ltsp-client > "${target}/etc/sitesummary/hostclass"
+
+	# Care for temporary mounts.
+	umount "${target}/dev/pts"
+	umount "${target}/proc"
+
+	# Create optional SqashFS image file.
+	if [ "yes" == "${create_squashfs_image}"  ] ; then
+		${ltsp} image "${ltspchroot}"
+	fi
+
+	# FIXME: Create ltsp initrd (ltsp.img) and move it to the right location.
+	#ltsp initrd
+	#mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/${ltspchroot}
+
+	# Update iPXE menu and adjust the created file for Debian Edu needs.
+	#ltsp ipxe
+	#FIXME: sed -i 's#ltsp/ltsp.img#ltsp/${img}/ltsp.img#' /srv/tftp/ltsp/ltsp.ipxe
+
+	# FIXME: Clean up ltsp.conf from image specific items.
+	#sed -i '/POST_INIT/d' /etc/ltsp/ltsp.conf
+	#sed -i '/LIGHTDM_CONF/d' /etc/ltsp/ltsp.conf
+}
+
+if [ "${sourced}" = "false" ]; then
+	do_debian_edu_ltspinstall_dlwchroot
+fi


=====================================
lib/debian-edu-config/ltsp-install.d/ltsp-variant_dlwltsphost
=====================================
@@ -0,0 +1,139 @@
+#!/bin/bash
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Licence:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+set -e
+
+
+# Check if this script is sourced or executed directly.
+( return 0 2>/dev/null ) && sourced=true || sourced=false
+
+if [ "${sourced}" = "false" ]; then
+
+	# Initialize required variables from debian-edu-config LTSP installer's vars directory.
+	ltsp_vars_dir="/usr/lib/debian-edu-config/ltsp-vars.d"
+	if [ -n "$(find ${ltsp_vars_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+		for vars_file in "${ltsp_vars_dir}"/[0-9][0-9]_{common,dlwltsphost}_*.sh; do
+			source "${vars_file}"
+		done
+	fi
+
+	# dlwltsphost variant only makes sense if we create the SquashFS image.
+	create_squashfs_image=${create_squashfs_image:-"true"}
+	trap cleanup_debian_edu_ltspinstall_dlwltsphost TERM INT EXIT
+else
+	do_install_function="do_debian_edu_ltspinstall_dlwltsphost"
+	cleanup_function="cleanup_debian_edu_ltspinstall_dlwltsphost"
+fi
+
+function cleanup_debian_edu_ltspinstall_dlwltsphost()
+{
+	trap - TERM INT EXIT
+	umount -q ${target}/dev/pts || true
+	umount -q ${target}/proc || true
+	if grep -q BD "/etc/apt/sources.list" && [ -f "/media/cdrom/.disk/info" ] ; then
+		umount "${target}/media/cdrom" || true
+		umount "/media/cdrom" || true
+	fi
+	exit 0
+}
+
+function do_debian_edu_ltspinstall_dlwltsphost()
+{
+
+	set -e
+
+	if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
+		echo "ERROR: Main-Server cannot be converted to a Diskless Workstation!"
+		exit -1
+	fi
+
+	# Abort if create_squashfs_image is set to "no".
+	if [ "true" != "${create_squashfs_image}"  ] ; then
+		echo "ERROR: You must use --create-squashfs-image as command line parameter!"
+		exit -1
+	fi
+
+	cat <<EOF >> /etc/ltsp/ltsp.conf
+LIGHTDM_CONF="greeter-hide-users"
+POST_INIT_USE_FQDN="sed -i '/10.0.2.2/ s/server/tjener.intern tjener/' /etc/hosts"
+EOF
+
+	# Debian Edu specific common additional image excludes; for diskless
+	# workstations the /skole mountpoint (for autofs) needs to be clean.
+	# This applies for both a combined server and a separate LTSP server.
+	# For a combined server image the autofs service needs to be enabled (see below).
+	if echo "$PROFILE" | grep -Eq 'Workstation|LTSP-Server' ; then
+		cat <<EOF > /etc/ltsp/image-local.excludes
+skole/*
+EOF
+	fi
+
+	# FIXME: is this needed?
+	#if [ -e /etc/environment ]; then
+	#	. /etc/environment
+	#fi
+
+	ltsp="$(command -v ltsp)"
+	if [ -z "${ltsp}" ]; then
+		echo "ERROR: '$ltsp' not found, install via \`apt-get install ltsp\`"
+		exit 1
+	fi
+
+	cat <<EOF >> /etc/ltsp/ltsp.conf
+MASK_SYSTEM_SERVICES="etckeeper exim4 tftpd-hpa isc-dhcp-server xrdp xrdp-sesman"
+EOF
+
+	# FIXME:
+	# Temporary workaround needed in some cases for configuring the resolver inside
+	# the SquashFS image.
+	#rm -f /etc/resolv.conf
+	#echo "nameserver $dns_server" > /etc/resolv.conf
+	#echo "search intern" >> /etc/resolv.conf
+
+	# FIXME: Temporary workaround needed to turn DLW images into machines of profile type 'Workstation'
+	#sed -i /etc/debian-edu/config -e "s/^PROFILE=.*/PROFILE=\"Workstation\"/g"
+	# Create SqashFS image.
+	ltsp image /,,/boot,subdir=boot,,/usr,subdir=usr,,/var,subdir=var
+
+	# FIXME: Revert resolver workaround from above.
+	#rm -f /etc/resolv.conf
+	#ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
+
+	# FIXME: Revert temporary change to PROFILE in /etc/debian-edu/config
+	#sed -i /etc/debian-edu/config -e "s/^PROFILE=.*/PROFILE=\"${PROFILE}\"/g"
+	# next modification avoids ltsp command error if lot of images are available.
+	ALL_IMAGES=1 ltsp kernel
+	ltsp initrd
+	if uname -r | grep -q 686 ; then
+		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/x86_32/ltsp.img
+	else
+		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/"$(uname -m)"/ltsp.img
+	fi
+
+	# FIXME: Clean up ltsp.conf from specific items.
+	#sed -i '/PRE_INIT_MAIN/d' /etc/ltsp/ltsp.conf
+	#sed -i '/PRE_INIT_AUTOFS/d' /etc/ltsp/ltsp.conf
+	#sed -i '/MASK_SYSTEM/d' /etc/ltsp/ltsp.conf
+
+	# FIXME: Create ltsp initrd (ltsp.img) and move it to the right location.
+	#ltsp initrd
+	#mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/${dlw}
+
+	# Update iPXE menu and adjust the created file for Debian Edu needs.
+	#ltsp ipxe
+	#FIXME: sed -i 's#ltsp/ltsp.img#ltsp/${img}/ltsp.img#' /srv/tftp/ltsp/ltsp.ipxe
+
+	# FIXME: Clean up ltsp.conf from image specific items.
+	#sed -i '/POST_INIT/d' /etc/ltsp/ltsp.conf
+	#sed -i '/LIGHTDM_CONF/d' /etc/ltsp/ltsp.conf
+}
+
+if [ "${sourced}" = "false" ]; then
+	do_debian_edu_ltspinstall_dlwltsphost
+fi


=====================================
lib/debian-edu-config/ltsp-install.d/ltsp-variant_x2godisplaymanager
=====================================
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Licence:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+set -e
+
+# Check if this script is sourced or executed directly.
+( return 0 2>/dev/null ) && sourced=true || sourced=false
+
+if [ "${sourced}" = "false" ]; then
+
+	# Initialize required variables from debian-edu-config LTSP installer's vars directory.
+	ltsp_vars_dir="/usr/lib/debian-edu-config/ltsp-vars.d"
+	if [ -n "$(find ${ltsp_vars_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+		for vars_file in "${ltsp_vars_dir}"/[0-9][0-9]_{common,x2godisplaymanager}_*.sh; do
+			source "${vars_file}"
+		done
+	fi
+
+	create_squashfs_image=${create_squashfs_image:-"false"}
+	trap cleanup_debian_edu_ltspinstall_x2godisplaymanager TERM INT EXIT
+else
+	do_install_function="do_debian_edu_ltspinstall_x2godisplaymanager"
+	cleanup_function="cleanup_debian_edu_ltspinstall_x2godisplaymanager"
+fi
+
+function cleanup_debian_edu_ltspinstall_x2godisplaymanager()
+{
+	trap - TERM INT EXIT
+	umount -q ${target}/dev/pts || true
+	umount -q ${target}/proc || true
+	if grep -q BD "/etc/apt/sources.list" && [ -f "/media/cdrom/.disk/info" ] ; then
+		umount "${target}/media/cdrom" || true
+		umount "/media/cdrom" || true
+	fi
+	exit 0
+}
+
+function do_debian_edu_ltspinstall_x2godisplaymanager() {
+
+	set -e
+
+	x2go_script="$(command -v x2gothinclient_create)"
+	if [ -z "${x2go_script}" ]; then
+		echo "ERROR: '$x2go_script' not found, install via \`apt-get install x2gothinclient-management\`"
+		exit 1
+	fi
+
+	ltsp="$(command -v ltsp)"
+	if [ -z "${ltsp}" ]; then
+		echo "ERROR: '$ltsp' not found, install via \`apt-get install ltsp\`"
+		exit 1
+	fi
+
+	create_squashfs_img=${create_squashfs_img:-"no"}
+
+	export TC_BASE="/srv/ltsp"
+	export TC_CHROOT="${TC_BASE}/${ltspchroot}"
+	export TC_CONFIG="/srv/x2gothinclient/${ltspchroot}/config"
+	export TC_DISTRO_CODENAME="${dist}"
+	export TC_DEBMIRROR_URL="http://deb.debian.org/debian"
+	export TC_X2GO_DEBURL=""
+	export TC_NONINTERACTIVE="true"
+	export TC_FLAVOUR="displaymanager"
+	export TC_ARCH="${arch}"
+
+	x2gothinclient_create
+
+	# Create optional SquashFS image file.
+	if [ "yes" == "${create_squashfs_image}"  ] ; then
+		${ltsp} image "${ltspchroot}"
+	fi
+}
+
+if [ "${sourced}" = "false" ]; then
+	do_debian_edu_ltspinstall_x2godisplaymanager
+fi


=====================================
lib/debian-edu-config/ltsp-install.d/ltsp-variant_x2gominidesktop
=====================================
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Licence:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+set -e
+
+# Check if this script is sourced or executed directly.
+( return 0 2>/dev/null ) && sourced=true || sourced=false
+
+if [ "${sourced}" = "false" ]; then
+
+	# Initialize required variables from debian-edu-config LTSP installer's vars directory.
+	ltsp_vars_dir="/usr/lib/debian-edu-config/ltsp-vars.d"
+	if [ -n "$(find ${ltsp_vars_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+		for vars_file in "${ltsp_vars_dir}"/[0-9][0-9]_{common,x2gominidesktop}_*.sh; do
+			source "${vars_file}"
+		done
+	fi
+
+	create_squashfs_image=${create_squashfs_image:-"false"}
+	trap cleanup_debian_edu_ltspinstall_x2gominidesktop TERM INT EXIT
+else
+	do_install_function="do_debian_edu_ltspinstall_x2gominidesktop"
+	cleanup_function="cleanup_debian_edu_ltspinstall_x2gominidesktop"
+fi
+
+function cleanup_debian_edu_ltspinstall_x2gominidesktop()
+{
+	trap - TERM INT EXIT
+	umount -q ${target}/dev/pts || true
+	umount -q ${target}/proc || true
+	if grep -q BD "/etc/apt/sources.list" && [ -f "/media/cdrom/.disk/info" ] ; then
+		umount "${target}/media/cdrom" || true
+		umount "/media/cdrom" || true
+	fi
+	exit 0
+}
+function do_debian_edu_ltspinstall_x2gominidesktop() {
+
+	set -e
+
+	x2gotce_create="$(command -v x2gothinclient_create)"
+	if [ -z "${x2gotce_create}" ]; then
+		echo "ERROR: '${x2gotce_create}' not found, install via \`apt-get install x2gothinclient-management\`"
+		exit 1
+	fi
+
+	ltsp="$(command -v ltsp)"
+	if [ -z "${ltsp}" ]; then
+		echo "ERROR: '$ltsp' not found, install via \`apt-get install ltsp\`"
+		exit 1
+	fi
+
+	export TC_BASE="/srv/ltsp"
+	export TC_CHROOT="${TC_BASE}/${ltspchroot}"
+	export TC_CONFIG="/srv/x2gothinclient/${ltspchroot}/config"
+	export TC_DISTRO_CODENAME="${dist}"
+	export TC_DEBMIRROR_URL="http://deb.debian.org/debian"
+	export TC_X2GO_DEBURL=""
+	export TC_NONINTERACTIVE="true"
+	export TC_FLAVOUR="minidesktop"
+	export TC_ARCH="${arch}"
+
+	x2gothinclient_create
+
+	# Create optional SquashFS image file.
+	if [ "yes" == "${create_squashfs_image}"  ] ; then
+		${ltsp} image "${ltspchroot}"
+	fi
+
+if [ "${sourced}" = "false" ]; then
+	do_debian_edu_ltspinstall_x2gominidesktop
+fi


=====================================
lib/debian-edu-config/ltsp-postinst.d/90_common_apt-sources.sh
=====================================
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - tweak APT sources if BD ISO images is used
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+# Unmount the BD image, if it was mounted at the start of this script.
+if [ "yes" == "$bd_iso_was_mounted" ] ; then
+	umount /srv/ltsp/*/media/cdrom
+fi


=====================================
lib/debian-edu-config/ltsp-preinst.d/09_common_x2go-autodetect-desktop.sh
=====================================
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - provide default X2Go Client settings
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-15
+
+set -e
+
+autodetect_x2go_desktop () {
+	# select the first found desktop as the default, based on what x2goclient
+	# (src/onmainwindow.cpp) and x2goserver (x2goserver/bin/x2goruncommand)
+	# support
+	if [ -x /usr/bin/startxfce4 ]; then # from xfce4-session
+		echo XFCE
+	elif [ -x /usr/bin/startplasma-x11 ]; then # from plasma-workspace
+		echo KDE
+	elif [ -x /usr/bin/gnome-session ]; then # from gnome-session-bin
+		echo GNOME
+	elif [ -x /usr/bin/mate-session ]; then # from mate-session
+		echo MATE
+	elif [ -x /usr/bin/startlxde ]; then # from openbox-lxde-session
+		echo LXDE
+	elif [ -x /usr/bin/startlxqt ]; then # from lxqt-session
+		echo LXQT
+	elif [ -x /usr/bin/cinnamon-session-cinnamon2d ]; then # from cinnamon
+		echo CINNAMON
+	elif [ -x /usr/bin/openbox-session ]; then # from openbox
+		echo OPENBOX
+	elif [ -x /usr/bin/icewm-session ]; then # from icewm
+		echo ICEWM
+	else
+		echo TERMINAL
+	fi
+}


=====================================
lib/debian-edu-config/ltsp-preinst.d/10_x2godisplaymanager_x2goclient-setup.sh
=====================================
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - provide default X2Go Client settings
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-09-28
+
+set -e
+
+x2go_desktop="${x2go_desktop:-$(autodetect_x2go_desktop)}"
+
+# Needed for X2Go Client configuration.
+mkdir -p /etc/ltsp/skel/.x2goclient
+cat <<EOF > /etc/ltsp/skel/.x2goclient/printing
+[General]
+pdfview=false
+showdialog=true
+
+[CUPS]
+defaultprinter=
+
+[print]
+command=lpr
+ps=false
+startcmd=false
+stdin=false
+
+[view]
+command=xpdf
+open=true
+EOF
+
+# Needed for X2Go Client (preconfigured session).
+cat <<EOF > /etc/ltsp/skel/.x2goclient/sessions
+[default]
+autologin=false
+clipboard=both
+command=${x2go_desktop}
+defsndport=true
+directrdp=false
+directrdpsettings=
+directxdmcp=false
+directxdmcpsettings=
+display=1
+dpi=96
+export="/usb0:1;"
+fstunnel=true
+fullscreen=true
+height=600
+host=$(hostname -s)
+icon=/usr/share/icons/hicolor/64x64/apps/x2goclient.png
+iconvfrom=ISO8859-1
+iconvto=UTF-8
+krbdelegation=false
+krblogin=false
+maxdim=false
+multidisp=false
+name=Debian Edu Terminal-Server
+pack=16m-jpeg
+print=true
+published=false
+quality=9
+rootless=false
+setdpi=true
+sndport=4713
+sound=true
+soundsystem=pulse
+soundtunnel=true
+speed=4
+sshport=22
+sshproxyautologin=false
+startsoundsystem=true
+type=auto
+useiconv=false
+usekbd=true
+usesshproxy=false
+width=800
+xdmcpclient=Xnest
+xdmcpserver=localhost
+xinerama=false
+EOF
+
+# Needed for thin client x2goclient configuration.
+cat <<EOF > /etc/ltsp/skel/.x2goclient/settings
+[toolbar]
+show=false
+EOF


=====================================
lib/debian-edu-config/ltsp-preinst.d/10_x2gominidesktop_x2goclient-setup.sh
=====================================
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - provide default X2Go Client settings
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-15
+
+set -e
+
+x2go_desktop="${x2go_desktop:-$(autodetect_x2go_desktop)}"
+
+# Needed for X2Go Client configuration.
+mkdir -p /etc/ltsp/skel/.x2goclient
+cat <<EOF > /etc/ltsp/skel/.x2goclient/printing
+[General]
+pdfview=false
+showdialog=true
+
+[CUPS]
+defaultprinter=
+
+[print]
+command=lpr
+ps=false
+startcmd=false
+stdin=false
+
+[view]
+command=xpdf
+open=true
+EOF
+
+# Needed for X2Go Client (preconfigured session).
+cat <<EOF > /etc/ltsp/skel/.x2goclient/sessions
+[default]
+autologin=false
+clipboard=both
+command=${x2go_desktop}
+defsndport=true
+directrdp=false
+directrdpsettings=
+directxdmcp=false
+directxdmcpsettings=
+display=1
+dpi=96
+export="/usb0:1;"
+fstunnel=true
+fullscreen=true
+height=600
+host=$(hostname -s)
+icon=/usr/share/icons/hicolor/64x64/apps/x2goclient.png
+iconvfrom=ISO8859-1
+iconvto=UTF-8
+krbdelegation=false
+krblogin=false
+maxdim=false
+multidisp=false
+name=Debian Edu Terminal-Server
+pack=16m-jpeg
+print=true
+published=false
+quality=9
+rootless=false
+setdpi=true
+sndport=4713
+sound=true
+soundsystem=pulse
+soundtunnel=true
+speed=4
+sshport=22
+sshproxyautologin=false
+startsoundsystem=true
+type=auto
+useiconv=false
+usekbd=true
+usesshproxy=false
+width=800
+xdmcpclient=Xnest
+xdmcpserver=localhost
+xinerama=false
+EOF
+
+# Needed for thin client x2goclient configuration.
+cat <<EOF > /etc/ltsp/skel/.x2goclient/settings
+[toolbar]
+show=false
+EOF


=====================================
lib/debian-edu-config/ltsp-preinst.d/20_common_apt-sources.sh
=====================================
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - tweak APT sources if BD ISO images is used
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-10-14
+
+if [ "true" = "${apt_setup_needed}" ]; then
+
+	# If the BD ISO image is used, ensure that it is mounted.
+	if grep -q BD /etc/apt/sources.list && ! mountpoint -q /media/cdrom; then
+		bd_iso_was_mounted="yes"
+		mount /media/cdrom -o ro
+	fi
+
+	# If the BD ISO image is used, get as many packages as possible from the BD image instead of downloading them.
+	if grep -q BD /etc/apt/sources.list && [ -e /media/cdrom/.disk/cd_type ]; then
+		BD_ISO="true";
+		mirror="file:///media/cdrom/"
+	else
+		mirror="http://deb.debian.org/debian"
+	fi
+
+fi


=====================================
lib/debian-edu-config/ltsp-preinst.d/90_common_ltsp-setup.sh
=====================================
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# Configure a Debian Edu system with 'LTSP-Server' profile':
+#
+# - pre-configure extra-defaults for LTSP iPXE boot menu
+
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# License:          GPL2+
+# first edited:     2019-11-21
+
+version=2026-09-28
+
+if [ ! -d /etc/ltsp/client ] ; then
+	mkdir -p /etc/ltsp/client/init
+
+	# We are using NFS/Kerberos (krb5i) and autofs instead of sshfs for home dirs.
+	touch  /etc/ltsp/client/init/54-pam.sh
+
+	# Debian Edu wants a greeter w/o user list, i.e. don't modify existing config.
+	touch  /etc/ltsp/client/init/55-display-manager.sh
+
+	# make ipxe menu entries more user friendly.
+	cat <<EOF > /etc/ltsp/ltsp.conf
+# /bin/sh -n
+# LTSP configuration file
+# Documentation=man:ltsp.conf(5)
+
+[server]
+# Provide a full menu name for x2go-bare-amd64.img
+IPXE_X2GO_BARE_AMD64_IMG="Plain X2Go Thin Client (64-Bit)"
+# Provide a full menu name for x2go-bare-i386.img
+IPXE_X2GO_BARE_I386_IMG="Plain X2Go Thin Client (32-Bit)"
+
+# Provide a full menu name for x2go-bare-amd64
+IPXE_X2GO_BARE_AMD64="Plain X2Go Thin Client (64-Bit, NFS rootfs)"
+# Provide a full menu name for x2go-bare-i386
+IPXE_X2GO_BARE_I386="Plain X2Go Thin Client (32-Bit, NFS rootfs)"
+
+# Provide a full menu name for x2go-display-amd64.img
+IPXE_X2GO_DISPLAY_AMD64_IMG="Display Mode X2Go Thin Client (64-Bit)"
+# Provide a full menu name for x2go-display-i386.img
+IPXE_X2GO_DISPLAY_I386_IMG="Display Mode X2Go Thin Client (32-Bit)"
+
+# Provide a full menu name for x2go-display-amd64
+IPXE_X2GO_DISPLAY_AMD64="Display Mode X2Go Thin Client (64-Bit, NFS rootfs)"
+# Provide a full menu name for x2go-display-i386
+IPXE_X2GO_DISPLAY_I386="Display Mode X2Go Thin Client (32-Bit, NFS rootfs)"
+
+# Provide a full menu name for x2go-desktop-amd64.img
+IPXE_X2GO_DESKTOP_AMD64_IMG="Desktop Mode X2Go Thin Client (64-Bit)"
+# Provide a full menu name for thin/desktop-i386.img
+IPXE_X2GO_DESKTOP_I386_IMG="Desktop Mode X2Go Thin Client (32-Bit)"
+
+# Provide a full menu name for x2go-desktop-amd64
+IPXE_X2GO_DESKTOP_AMD64="Desktop Mode X2Go Thin Client (64-Bit, NFS rootfs)"
+# Provide a full menu name for thin/desktop-i386
+IPXE_X2GO_DESKTOP_I386="Desktop Mode X2Go Thin Client (32-Bit, NFS rootfs)"
+
+# Provide a full menu name for x86_64.img
+IPXE_X86_64_IMG="Diskless Workstation (server's SquashFS image)"
+# Provide a full menu name for x86_32.img
+IPXE_X86_32_IMG="Diskless Workstation (32-Bit, server's SquashFS image)"
+
+# Provide a full menu name for dlw.img
+IPXE_DLW_IMG="Diskless Workstation (SquashFS image from chroot)"
+# Provide a full menu name for dlw
+IPXE_DLW="Diskless Workstation (Chroot as NFS rootfs)"
+
+##### Set default boot value ######
+# Default value is x86_64 or x86_32 (arch specific, Diskless Workstation)
+# Plain X2Go Thin Client (64-Bit)
+#DEFAULT_IMAGE="x2go-bare-amd64"
+# Plain X2Go Thin Client (32-Bit)
+#DEFAULT_IMAGE="x2go-bare-i386"
+# Display Mode X2Go Thin Client (64-Bit)
+#DEFAULT_IMAGE="x2go-display-amd64"
+# Desktop Mode X2Go Thin Client (64-Bit)
+#DEFAULT_IMAGE="x2go-desktop-amd64"
+# Diskless Workstation (Chroot as NFS rootfs)
+#DEFAULT_IMAGE="dlw"
+# Install Debian Edu/amd64 (64-Bit)
+#DEFAULT_IMAGE="amd64"
+# Install Debian Edu/i386  (32-Bit)
+#DEFAULT_IMAGE="i386"
+
+##### Set default iPXE menu timeout ######
+# Default value is 5000 milliseconds, i.e. 5 seconds.
+#MENU_TIMEOUT="5000"
+# Don't show the menu.
+#MENU_TIMEOUT="-1"
+
+# Debian Edu specific
+DNS_SERVER=10.0.2.2
+SEARCH_DOMAIN=intern
+ADD_IMAGE_EXCLUDES="/etc/ltsp/image-local.excludes"
+# This takes effect for hosts behind the LTSP eth1 interface.
+NAT=1
+
+# In the special [clients] section, parameters for all clients can be defined.
+# Most ltsp.conf parameters should be placed here.
+[clients]
+HOSTS_1="10.0.2.2 tjener.intern tjener"
+KERNEL_PARAMETERS="quiet splash"
+EOF
+fi


=====================================
lib/debian-edu-config/ltsp-vars.d/10_common_vars.sh
=====================================
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Required for setting the Debian Edu PROFILE variable.
+if [ -f /etc/debian-edu/config ]; then
+	source /etc/debian-edu/config
+fi
+
+# Primarily for setting http_proxy et al.
+if [ -e /etc/environment ]; then
+	source /etc/environment
+fi
+
+# Set distro codename value for both testing and stable release cases.
+if grep -q / /etc/debian_version ; then
+	dist_codename="$(cat /etc/debian_version | cut -d/ -f1)"
+else
+	dist_codename=$(lsb_release -sc)
+fi
+dist=${dist:-${dist_codename}}
+arch=${arch:-$(dpkg --print-architecture)}
+
+# Related to APT sources setup
+bd_iso_was_mounted="no"
+mirror="http://deb.debian.org/debian"
+apt_setup_needed="no"
+
+# Fallback desktop
+dlw_desktop="${dlw_desktop:-"xfce"}"
+
+# Fallback X2Go session type
+x2go_desktop="${x2go_desktop:-"XFCE"}"


=====================================
lib/debian-edu-config/ltsp-vars.d/20_dlwchroot_vars.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Define target directory and ltspchroot name
+ltspchroot="dlw+${dist}+${arch}"
+target="/srv/ltsp/${ltspchroot}"
+do_chroot="chroot ${target}"
+
+# APT setup required
+apt_setup_needed="yes"


=====================================
lib/debian-edu-config/ltsp-vars.d/20_x2godisplaymanager_vars.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Define target directory and ltspchroot name
+ltspchroot="x2godisplaymanager+${dist}+${arch}"
+target="/srv/ltsp/${ltspchroot}"
+do_chroot="chroot ${target}"
+
+# APT setup required
+apt_setup_needed="yes"


=====================================
lib/debian-edu-config/ltsp-vars.d/20_x2gominidesktop_vars.sh
=====================================
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Define target directory and ltspchroot name
+ltspchroot="x2gominidesktop+${dist}+${arch}"
+target="/srv/ltsp/${ltspchroot}"
+do_chroot="chroot ${target}"
+
+# APT setup required
+apt_setup_needed="yes"


=====================================
sbin/debian-edu-ltsp-install
=====================================
@@ -14,794 +14,233 @@
 # https://wiki.debian.org/DebianEdu/Documentation/Bookworm/HowTo/Administration#Kerberized_NFS
 # The modified system provides a separate LTSP client network attached to eth1.
 #
-# Author/Copyright:	Wolfgang Schweer <wschweer at arcor.de>
-# Licence:		GPL2+
-# first edited:	2019-11-21
+# Author/Copyright: Wolfgang Schweer <wschweer at arcor.de>
+#                   Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+# Licence:          GPL2+
+# first edited:     2019-11-21
 
-version=2023-03-25
+version=2026-10-14
+ltsp_preinst_dir="/usr/lib/debian-edu-config/ltsp-preinst.d/"
+ltsp_install_dir="/usr/lib/debian-edu-config/ltsp-install.d/"
+ltsp_postinst_dir="/usr/lib/debian-edu-config/ltsp-postinst.d/"
 
 set -e
 
-select_desktop () {
-    # select the first found desktop as the default, based on what x2goclient
-    # (src/onmainwindow.cpp) and x2goserver (x2goserver/bin/x2goruncommand)
-    # support
-    if [ -x /usr/bin/startxfce4 ]; then # from xfce4-session
-        echo XFCE
-    elif [ -x /usr/bin/startplasma-x11 ]; then # from plasma-workspace
-        echo KDE
-    elif [ -x /usr/bin/gnome-session ]; then # from gnome-session-bin
-        echo GNOME
-    elif [ -x /usr/bin/mate-session ]; then # from mate-session
-        echo MATE
-    elif [ -x /usr/bin/startlxde ]; then # from openbox-lxde-session
-        echo LXDE
-    elif [ -x /usr/bin/startlxqt ]; then # from lxqt-session
-        echo LXQT
-    elif [ -x /usr/bin/cinnamon-session-cinnamon2d ]; then # from cinnamon
-        echo CINNAMON
-    elif [ -x /usr/bin/openbox-session ]; then # from openbox
-        echo OPENBOX
-    elif [ -x /usr/bin/icewm-session ]; then # from icewm
-        echo ICEWM
-    else
-        echo XFCE
-    fi
-}
-
 # usage
-if [ -z "$1" ] ; then
-	echo "Use $0 -h or $0 --help for more information"
+if [[ -z "${@}" ]] ; then
+	echo "Use '$(basename $0) -h' or '$(basename $0) --help' for more information."
 	exit 0
 fi
 
-if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
+function usage() {
+	exec_name="$(basename $0)"
+	indent___="$(printf '%*s\n' "${#exec_name}")"
+	if [ -d "${ltsp_install_dir}" ]; then
+		variants=$(cd ${ltsp_install_dir}; ls -1 * | cut -d "_" -f2 | sed -e "s/^/                       /")
+	else
+		variants="                       none installed"
+	fi
 	cat <<EOF
 
 Usage information:
 
-debian-edu-ltsp-install --arch <amd64|i386> --dist <stable|testing|sid> --dns_server <10.0.2.2|dns server ip> --diskless_workstation <yes|no> --thin_type <bare|display|desktop> --dlw <yes|no> --img <yes|no> --desktop <xfce|cinnamon|gnome|kde|lxde|lxqt|mate|none> --x2go_desktop <xfce|cinnamon|gnome|kde|lxde|lxqt|mate|openbox|icewm>
+${exec_name} [--arch <amd64|i386>] [--dist <codename>] [--dns-server <dns-server-ip>]
+${indent___} [--create-squashfs-image <yes|no>]
+${indent___} [--dlw-desktop <xfce|cinnamon|gnome|kde|lxde|lxqt|mate|none>]
+${indent___} --install-variant dlw{chroot,ltsphost}
+
+${exec_name} [--arch <amd64|i386>] [--dist <codename>] [--dns-server <dns-server-ip>]
+${indent___} [--create-squashfs-image]
+${indent___} [--x2goserver-desktop <xfce|cinnamon|gnome|kde|lxde|lxqt|mate|openbox|icewm>]
+${indent___} --install-variant x2go{minidesktop,displaymanager}
+
+Create LTSP chroots/images to be booted via PXE over the network. This script supports two major variants of LTSP chroots/images:
+  - Diskless Workstation (dlw-*) chroots/images
+  - X2Go Thin Client (x2go-*) chroots/images
+
+Mandatory argument:
 
-Turn a Debian Edu workstation into an LTSP server for both diskless
-workstations and thin clients.
+  --install-variant    Must be specified on the command line. Available variants:
+${variants}
 
---arch       takes effect for a thin client chroot setup, default value is the system architecture one.
+Optional parameters:
 
---dist       takes effect for a LTSP/X2Go client chroot setup, default value is the one the LTSP server is running.
+  --arch                  Takes affect for all variants except 'dlw-ltsphost' (default: host-architecture).
 
---dns_server defaults to 10.0.2.2 if omitted.
+  --distro-codename       Debian codename, such as trixie, forky, sid (default: same-as-host)
 
---diskless_workstation defaults to no if omitted.
+  --dns-server            Override DNS server IP address (default: 10.0.2.2)
 
---dlw        used to create a diskless workstation LTSP chroot (root fs via NFS), default is no.
+  --create-squashfs-image Create LTSP squashfs image from created chroot (default: not set)
 
---img        takes effect for LTSP diskless workstation and X2Go thin client chroot setup, default is yes.
+  --dlw-desktop           Only takes effect for LTSP diskless workstation chroot setups
+                          (default: xfce).
 
---desktop    takes effect for LTSP diskless workstation chroot setup, default is xfce.
-             Other values: cinnamon, gnome, kde, lxde, lxqt, mate.
-             (And 'none' for modular installations - also useful for testing).
+                          Other possible values: cinnamon, gnome, kde, lomiri, lxde, lxqt, mate.
+                          (Plus 'none' for modular installations - useful for testing).
 
---x2go_desktop takes effect for X2Go thin client setup, default is any
-             of the installed desktop environments
-             Other values: cinnamon, gnome, kde, lxde, lxqt, mate, openbox,
-                           icewm
+  --x2goserver-desktop    Only takes effect for X2Go Thin Client setups, default is any
+                          of the installed desktop environments supported by X2Go.
 
---thin_type  has no default value. These are available:
-    bare:    preconfigured x2go client running via 'startx' as user 'thin' with sound and
-             client side mass storage support.
-    display: x2gothinclient running in display mode.
-    desktop: x2gothinclient running in minidesktop mode.
+                          Other possible values: cinnamon, gnome, kde, lxde, lxqt, mate, openbox,
+                          icewm.
 
-Example 1: 'debian-edu-ltsp-install --diskless_workstation yes' creates diskless workstation support (SquashFS image).
+  --configure-ltsp-ipxe   Create/update iPXE boot environment configuration for LTSP.
 
-Example 2: 'debian-edu-ltsp-install --arch amd64 --diskless_workstation yes --thin_type bare' creates diskless workstation
-            and 64-bit thin client support. LTSP client boot defaults to diskless workstation.
+  --configure-ltsp-nfs    Create/update NFS server configuration for LTSP.
 
-Example 3: 'debian-edu-ltsp-install --arch i386 --thin_type bare' creates additional 32-bit thin client support.
+  --version               Show version of this script.
 
-Example 4: 'debian-edu-ltsp-install --diskless_workstation yes' updates the diskless workstation SquashFS image.
+Example 1: 'debian-edu-ltsp-install --install-variant dlw-debootstrap'
+            => This creates a diskless workstation chroot from scratch (but no SquashFS image).
 
-Example 5: 'debian-edu-ltsp-install --dlw yes --img no' creates a diskless workstation LTSP chroot.
-            Please note that about 15 GiB of additional disk space is needed. In the default case, run the commands
+Example 2: 'debian-edu-ltsp-install --install-variant dlw-debootstrap --create-squashfs-image'
+            => This creates a diskless workstation chroot from scratch and creates SquashFS image
+                from it.
+
+            Please note that about 15 GiB of additional disk space might be needed for this. You
+            can provide extra space by running these commands:
             'lvresize -L+15G /dev/vg_system/srv+ltsp' and 'resize2fs /dev/vg_system/srv+ltsp'.
 
-Example 6: 'debian-edu-ltsp-install --dlw yes' creates diskless workstation LTSP chroot and
-           the related SquashFS image. Another 5 GiB more additional disk space is needed.
+Example 3: 'debian-edu-ltsp-install --install-variant dlw-ltsphost --create-squashfs-image'
+            => This creates a diskless workstation images from the LTSP host's filesystem
+               (no chroot gets created, though, the image is created from the LTSP host itself).
+
+                This installation variant is not avaiable on the Debian Edu Main-Server.
 
-This script applies to a system with two NICs on the internal backbone network.
+Example 4: 'debian-edu-ltsp-install --install-variant x2gothinclient-minidesktop --create-squashfs-image --arch i386'
+            => This create a 32-bit X2Go Thin Client chroot and SquashFS image. The X2Go Thin Client
+               boots into a minimal MATE desktop with local webbrowser and X2Go Client pre-configured.
 
+Example 5: 'debian-edu-ltsp-install --install-variant x2gothinclient-displaymanager'
+            => This create a 64-bit X2Go Thin Client chroot (but no SquashFS image). The X2Go Thin
+               Clients will use X2Go Client as display manager (no other local applications available
+               on the thinclient).
 EOF
-	exit 0
-fi
+}
 
-if [ -r /etc/debian-edu/config ] ; then
-    . /etc/debian-edu/config
-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)"
-else
-	dist=$(lsb_release -sc)
-fi
-# Set default values.
+# Define defaults.
 arch="$(dpkg --print-architecture)"
 dns_server="10.0.2.2"
-diskless_workstation="no"
-thin_type=""
-dlw="no"
-img="yes"
-desktop="xfce"
-x2go_desktop="$(select_desktop)"
+install_variant=""
+create_squashfs_img=false
+dlw_desktop="xfce"
+x2goserver_desktop="TERMINAL"
+configure_ltsp_ipxe=false
+configure_ltsp_nfs=false
 
 while [ $# -gt 0 ] ; do
-  case "$1" in
-    --arch) arch="$2" ; shift ;;
-    --dist) dist="$2" ; shift ;;
-    --dns_server) dns_server="$2"  ; shift ;;
-    --diskless_workstation) diskless_workstation="$2" ; shift ;;
-    --thin_type) thin_type="$2" ; shift ;;
-    --dlw) dlw="$2" ; shift ;;
-    --img) img="$2" ; shift ;;
-    --desktop) desktop="$2" ; shift ;;
-    --x2go_dektop)
-        x2go_desktop="$(printf '%s\n' "$2" | tr '[:lower:]' '[:upper:]')"
-        shift ;;
-    --version) echo $version; exit 0 ;;
-  esac
-  shift
+	case "$1" in
+		--help)
+			usage;
+			exit 0
+			;;
+		--arch)
+			arch="$2"
+			shift
+			;;
+		--distro-codname)
+			distro_codename="$2"
+			shift
+			;;
+		--dns-server)
+			dns_server="$2"
+			shift
+			;;
+		--install-variant)
+			install_variant="$2"
+			shift
+			;;
+		--create-squashfs-image)
+			create_squashfs_image=true
+			;;
+		--dlw-desktop)
+			dlw_desktop="$2"
+			shift
+			;;
+		--x2goserver-desktop)
+			x2goserver_desktop="$(printf '%s\n' "$2" | tr '[:lower:]' '[:upper:]')"
+			shift
+			;;
+		--configure-ltsp-ipxe)
+			configure_ltsp_ipxe=true
+			;;
+		--configure-ltsp-nfs)
+			configure_ltsp_nfs=true
+			;;
+		--version)
+			echo $version
+			exit 0
+			;;
+		*)
+			usage
+			exit -1
+			;;
+	esac
+	shift
 done
 
+if [ -z "${install_variant}" ]; then
+	echo "ERROR: The mandatory command line option '--install-variant' is missing!"
+	echo
+	echo "Use '$(basename $0) -h' or '$(basename $0) --help' for more information."
+	exit -2
+fi
+
 kernel_arch="$arch"
 
 # Special case i386.
 if [ "i386" == "$arch" ] ; then
 	#kernel_arch="686-pae"
-	# next one optimal for very old TC machines w/o PAE.
+	# the below is optimal for very old TC machines w/o PAE.
 	kernel_arch="686"
 fi
 
-# Common Debian Edu specific configuration (dirs and HERE documents), only minor
-# difference for thin clients and diskless workstation (in ltsp.conf), see below.
-# Next two lines are needed in case of a separate LTSP server.
-ETH0_IP="$(hostname -I | cut -d' ' -f1)"
-ETH1_IP="$(hostname -I | cut -d' ' -f2)"
-ETH1_IP=${ETH1_IP:-"192.168.0.254"}
-HOSTNAME="$(hostname -s)"
-if [ ! -d /etc/ltsp/client ] ; then
-	mkdir -p /etc/ltsp/client/init
-
-	# We are using NFS/Kerberos (krb5i) and autofs instead of sshfs for home dirs.
-	touch  /etc/ltsp/client/init/54-pam.sh
-
-	# Debian Edu wants a greeter w/o user list, i.e. don't modify existing config.
-	touch  /etc/ltsp/client/init/55-display-manager.sh
-
-	# make ipxe menu entries more user friendly.
-	cat <<EOF > /etc/ltsp/ltsp.conf
-# /bin/sh -n
-# LTSP configuration file
-# Documentation=man:ltsp.conf(5)
-
-[server]
-# Provide a full menu name for x2go-bare-amd64.img
-IPXE_X2GO_BARE_AMD64_IMG="Plain X2Go Thin Client (64-Bit)"
-# Provide a full menu name for x2go-bare-i386.img
-IPXE_X2GO_BARE_I386_IMG="Plain X2Go Thin Client (32-Bit)"
-
-# Provide a full menu name for x2go-bare-amd64
-IPXE_X2GO_BARE_AMD64="Plain X2Go Thin Client (64-Bit, NFS rootfs)"
-# Provide a full menu name for x2go-bare-i386
-IPXE_X2GO_BARE_I386="Plain X2Go Thin Client (32-Bit, NFS rootfs)"
-
-# Provide a full menu name for x2go-display-amd64.img
-IPXE_X2GO_DISPLAY_AMD64_IMG="Display Mode X2Go Thin Client (64-Bit)"
-# Provide a full menu name for x2go-display-i386.img
-IPXE_X2GO_DISPLAY_I386_IMG="Display Mode X2Go Thin Client (32-Bit)"
-
-# Provide a full menu name for x2go-display-amd64
-IPXE_X2GO_DISPLAY_AMD64="Display Mode X2Go Thin Client (64-Bit, NFS rootfs)"
-# Provide a full menu name for x2go-display-i386
-IPXE_X2GO_DISPLAY_I386="Display Mode X2Go Thin Client (32-Bit, NFS rootfs)"
-
-# Provide a full menu name for x2go-desktop-amd64.img
-IPXE_X2GO_DESKTOP_AMD64_IMG="Desktop Mode X2Go Thin Client (64-Bit)"
-# Provide a full menu name for thin/desktop-i386.img
-IPXE_X2GO_DESKTOP_I386_IMG="Desktop Mode X2Go Thin Client (32-Bit)"
-
-# Provide a full menu name for x2go-desktop-amd64
-IPXE_X2GO_DESKTOP_AMD64="Desktop Mode X2Go Thin Client (64-Bit, NFS rootfs)"
-# Provide a full menu name for thin/desktop-i386
-IPXE_X2GO_DESKTOP_I386="Desktop Mode X2Go Thin Client (32-Bit, NFS rootfs)"
-
-# Provide a full menu name for x86_64.img
-IPXE_X86_64_IMG="Diskless Workstation (server's SquashFS image)"
-# Provide a full menu name for x86_32.img
-IPXE_X86_32_IMG="Diskless Workstation (32-Bit, server's SquashFS image)"
-
-# Provide a full menu name for dlw.img
-IPXE_DLW_IMG="Diskless Workstation (SquashFS image from chroot)"
-# Provide a full menu name for dlw
-IPXE_DLW="Diskless Workstation (Chroot as NFS rootfs)"
-
-##### Set default boot value ######
-# Default value is x86_64 or x86_32 (arch specific, Diskless Workstation)
-# Plain X2Go Thin Client (64-Bit)
-#DEFAULT_IMAGE="x2go-bare-amd64"
-# Plain X2Go Thin Client (32-Bit)
-#DEFAULT_IMAGE="x2go-bare-i386"
-# Display Mode X2Go Thin Client (64-Bit)
-#DEFAULT_IMAGE="x2go-display-amd64"
-# Desktop Mode X2Go Thin Client (64-Bit)
-#DEFAULT_IMAGE="x2go-desktop-amd64"
-# Diskless Workstation (Chroot as NFS rootfs)
-#DEFAULT_IMAGE="dlw"
-# Install Debian Edu/amd64 (64-Bit)
-#DEFAULT_IMAGE="amd64"
-# Install Debian Edu/i386  (32-Bit)
-#DEFAULT_IMAGE="i386"
-
-##### Set default iPXE menu timeout ######
-# Default value is 5000 milliseconds, i.e. 5 seconds.
-#MENU_TIMEOUT="5000"
-# Don't show the menu.
-#MENU_TIMEOUT="-1"
-
-# Debian Edu specific
-DNS_SERVER=10.0.2.2
-SEARCH_DOMAIN=intern
-ADD_IMAGE_EXCLUDES="/etc/ltsp/image-local.excludes"
-# This takes effect for hosts behind the LTSP eth1 interface.
-NAT=1
-
-# In the special [clients] section, parameters for all clients can be defined.
-# Most ltsp.conf parameters should be placed here.
-[clients]
-POST_INIT_PRINTER="cp /etc/ltsp/p910d.conf /etc/default/p910d"
-HOSTS_1="10.0.2.2 tjener.intern tjener"
-HOSTS_2="$ETH1_IP $HOSTNAME"
-KERNEL_PARAMETERS="quiet splash"
-EOF
-fi
+# Get rid of additional excludes just in case they exist (main server).
+cat /dev/null > /etc/ltsp/image-local.excludes
 
-# Debian Edu specific common additional image excludes; for diskless
-# workstations the /skole mountpoint (for autofs) needs to be clean.
-# This applies for both a combined server and a separate LTSP server.
-# For a combined server image the autofs service needs to be enabled (see below).
-if echo "$PROFILE" | grep -Eq 'Workstation|LTSP-Server' ; then
-	cat <<EOF > /etc/ltsp/image-local.excludes
-skole/*
-EOF
-	cat <<EOF > /etc/ltsp/p910d.conf
-# Use attached USB printer (default is /dev/lp0, i.e. parallel port printer).
-P910ND_OPTS=" -f /dev/usb/lp0"
-# Debian specific (set to 1 to enable daemon start, default is 0)
-P910ND_START=1
-# See 'man p910nd' for details and settings.
-EOF
+# Source snippets from debian-edu-config LTSP installer's preinst directory.
+if [ -n "$(find ${ltsp_preinst_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+	for preinst_file in "${ltsp_preinst_dir}"/[0-9][0-9]_{common,${install_variant}}_*.sh; do
+		source "${preinst_file}"
+	done
 fi
 
-# FIXME: On the main server even more additional excludes might be useful.
-if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
-	cat <<EOF >> /etc/ltsp/image-local.excludes
-etc/apache2
-etc/bind
-etc/dbconfig-common
-etc/dovecot
-etc/etckeeper
-etc/gosa
-etc/freeradius
-etc/icinga
-etc/icinga2
-etc/icingaweb2
-etc/krb5kdc
-etc/krb5.keytab.imap
-etc/krb5.keytab.ldap
-etc/krb5.keytab.smtp
-etc/mysql
-etc/nagios
-etc/nagios-plugins
-etc/nagios3
-etc/samba
-etc/slbackup
-etc/slbackup-php
-usr/lib/apache2
-usr/lib/exim4
-usr/lib/icinga
-usr/log/samba/*
-usr/log/squid/*
-var/cache/apache2/*
-var/cache/apt/*
-var/cache/bind/*
-var/cache/debconf/*
-var/cache/etckeeper/*
-var/cache/gosa/*
-var/cache/icinga/*
-var/cache/munin/*
-var/cache/nscd/*
-var/cache/samba/*
-var/lib/apache2/*
-var/lib/cfengine3/*
-var/lib/dbus/*
-var/lib/dhcp/*
-var/lib/dpkg/*
-var/lib/exim4/*
-var/lib/icinga/*
-var/lib/ldap/*
-var/lib/munin/*
-var/lib/munin-node/*
-var/lib/nfs/*
-var/lib/samba/*
-var/log/apache2/*
-var/log/cfengine/*
-var/log/installer/*
-var/log/munin/*
-var/log/samba/*
-var/log/squid/*
-var/mail/*
-var/log/*.gz
-var/spool/squid
-EOF
+# Run the LTSP variant's installation script.
+if [ -r "${ltsp_install_dir}/ltsp-variant_${install_variant}" ]; then
+	source ${ltsp_install_dir}/ltsp-variant_${install_variant}
+	trap "${do_cleanup_function}" TERM INT EXIT
+	${do_install_function}
 fi
 
-# Needed for thin client auto login user.
-mkdir -p /etc/ltsp/getty at tty1.service.d
-cat <<EOF > /etc/ltsp/getty at tty1.service.d/override.conf
-[Service]
-ExecStart=
-ExecStart=-/usr/sbin/agetty -a thin --noclear %I $TERM
-RestartSec=10
-EOF
-
-# Needed for thin client autofs setup (USB mass storage support (rw mode).
-mkdir -p /etc/ltsp/autofs
-cat <<EOF > /etc/ltsp/autofs/extra.autofs
-/- /etc/auto.usb0 --mode=0777 --timeout=3
-EOF
-cat <<EOF > /etc/ltsp/autofs/auto.usb0
-/usb0 -fstype=auto,rw,user,umask=000 :/dev/sda1
-EOF
-
-# Needed for thin client auto login configuration (startx).
-mkdir -p /etc/ltsp/skel
-cat <<EOF > /etc/ltsp/skel/.profile
-while true ; do
-	startx
-done
-EOF
-
-# Needed for thin client auto login configuration (x2goclient start).
-cat <<EOF > /etc/ltsp/skel/.xinitrc
-exec x2goclient --no-menu --add-to-known-hosts --no-session-edit --close-disconnect
-EOF
-
-# Needed for thin client x2goclient configuration.
-mkdir -p /etc/ltsp/skel/.x2goclient
-cat <<EOF > /etc/ltsp/skel/.x2goclient/printing
-[General]
-pdfview=false
-showdialog=true
-
-[CUPS]
-defaultprinter=
-
-[print]
-command=lpr
-ps=false
-startcmd=false
-stdin=false
-
-[view]
-command=xpdf
-open=true
-EOF
-
-# Needed for thin client (x2goclient preconfigured session).
-cat <<EOF > /etc/ltsp/skel/.x2goclient/sessions
-[default]
-autologin=false
-clipboard=both
-command=$x2go_desktop
-defsndport=true
-directrdp=false
-directrdpsettings=
-directxdmcp=false
-directxdmcpsettings=
-display=1
-dpi=96
-export="/usb0:1;"
-fstunnel=true
-fullscreen=true
-height=600
-host=$(hostname -s)
-icon=/usr/share/icons/hicolor/64x64/apps/x2goclient.png
-iconvfrom=ISO8859-1
-iconvto=UTF-8
-krbdelegation=false
-krblogin=false
-maxdim=false
-multidisp=false
-name=Debian Edu Thin Client
-pack=16m-jpeg
-print=true
-published=false
-quality=9
-rootless=false
-setdpi=true
-sndport=4713
-sound=true
-soundsystem=pulse
-soundtunnel=true
-speed=4
-sshport=22
-sshproxyautologin=false
-startsoundsystem=true
-type=auto
-useiconv=false
-usekbd=true
-usesshproxy=false
-width=800
-xdmcpclient=Xnest
-xdmcpserver=localhost
-xinerama=false
-EOF
-
-# Needed for thin client x2goclient configuration.
-cat <<EOF > /etc/ltsp/skel/.x2goclient/settings
-[toolbar]
-show=false
-EOF
-
-# If the BD ISO image is used, ensure that it is mounted.
-if grep -q BD /etc/apt/sources.list && ! mountpoint -q /media/cdrom ; then
-	bd_iso_was_mounted="yes"
-	mount /media/cdrom -o ro
-fi
-# If the BD ISO image is used, get as many packages as possible from the BD image instead of downloading them.
-if grep -q BD /etc/apt/sources.list && [ -e /media/cdrom/.disk/cd_type ] ; then
-	BD_ISO="true";
-	mirror="file:///media/cdrom/"
-else
-	mirror="http://deb.debian.org/debian"
-fi
-
-# Create thin client chroot and generate image.
-export DEBIAN_FRONTEND=noninteractive
-if ! [ "" == "$thin_type" ] && [ ! -d /srv/tftp/ltsp/x2go-"$thin_type"-"$arch"/etc/ltsp ] ; then
-	mkdir -p /srv/tftp/ltsp/x2go-"$thin_type"-"$arch"
-	# Install common thin client packages.
-debootstrap --arch="$arch" --no-check-gpg --variant=minbase --include=sitesummary-client,linux-image-"$kernel_arch" \
-	"$dist" /srv/ltsp/x2go-"$thin_type"-"$arch" "$mirror"
-	# Unset temporary directory variables to avoid problems when directory
-	# is missing inside the chroot. https://bugs.debian.org/765443
-	unset TMPDIR TEMP TEMPDIR TMP
-	chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ apt clean
-	# Care for complete sources list (security, also nonfree -- in case firmware is needed).
-	if [ -e /srv/ltsp/x2go-"$thin_type"-"$arch"/usr/share/doc/apt/examples/sources.list ] ; then
-		# Up to bookworm
-		chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ sh -c "cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list.d/full.list"
-	else
-		# Since trixie
-		chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ sh -c "cp /usr/share/doc/apt/examples/debian.sources /etc/apt/sources.list.d/debian_full.sources"
-	fi
-	mount /dev/pts -t devpts /srv/ltsp/x2go-"$thin_type"-"$arch"/dev/pts
-	mount proc -t proc /srv/ltsp/x2go-"$thin_type"-"$arch"/proc
-	if [ "true" == "$BD_ISO" ] ; then
-		mkdir -p /srv/ltsp/x2go-"$thin_type"-"$arch"/media/cdrom
-		mount /media/cdrom /srv/ltsp/x2go-"$thin_type"-"$arch"/media/cdrom -o bind
-		echo "deb [trusted=yes] $mirror $dist main" > /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/apt/sources.list
-	fi
-	chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ apt -y -qq install education-thin-client p910nd
-	# Install case specific additional packages.
-	if [ "display" == "$thin_type" ] ; then
-		chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ apt -y -qq install x2gothinclient-displaymanager
-	fi
-	if [ "desktop" == "$thin_type" ] ; then
-		chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ apt -y -qq install x2gothinclient-minidesktop \
-		x2gothinclient-cdmanager x2gothinclient-usbmount
-		if ! [ "en" == "$LANGCODE" ] ; then
-			chroot /srv/ltsp/x2go-"$thin_type"-"$arch"/ apt -y -qq install firefox-esr-l10n-"$LANGCODE"
-		fi
-	fi
-	if [ "true" == "$BD_ISO" ] ; then
-		umount /srv/ltsp/x2go-"$thin_type"-"$arch"/media/cdrom
-	fi
-	umount /srv/ltsp/x2go-"$thin_type"-"$arch"/dev/pts
-	umount /srv/ltsp/x2go-"$thin_type"-"$arch"/proc
-	if [ "bare" == "$thin_type" ] ; then
-		rm -rf /srv/ltsp/x2go-"$thin_type"-"$arch"/var/cache/debconf
-		rm -rf /srv/ltsp/x2go-"$thin_type"-"$arch"/var/cache/man
-	fi
-	# Configure locale et al.
-	cp /etc/locale.gen /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/
-	cp /etc/default/locale /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/default
-	chroot /srv/ltsp/x2go-"$thin_type"-"$arch" locale-gen
-	cp /etc/default/keyboard /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/default
-	cp /etc/default/console-setup /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/default
-	chroot /srv/ltsp/x2go-"$thin_type"-"$arch" setupcon -k
-	# Configure Sitesummary.
-	cp -r /etc/sitesummary/config.d/ /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/sitesummary/
-	cp -f /etc/sitesummary/site /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/sitesummary/
-	cp -f /etc/sitesummary/sitegroup /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/sitesummary/
-	echo ltsp-client > /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/sitesummary/hostclass
-
-	# Customize X2Go client for Debian Edu use.
-	if [ "display" == "$thin_type" ] || [ "desktop" == "$thin_type" ] ; then
-		cp /etc/ltsp/skel/.x2goclient/sessions /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/x2go/x2gothinclient_sessions
-	fi
-	# Firefox-ESR customization for Debian Edu.
-	if [ "desktop" == "$thin_type" ] ; then
-		cp /etc/environment /srv/ltsp/x2go-"$thin_type"-"$arch"/etc
-		cp /etc/firefox-esr/debian-edu.js /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/firefox-esr
-		cp /etc/firefox-esr/debian-edu-homepage-ldap.js /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/firefox-esr
-		cp /etc/ssl/certs/Debian-Edu_rootCA.crt /srv/ltsp/x2go-"$thin_type"-"$arch"/etc/ssl/certs
-		cat <<EOF > /srv/ltsp/x2go-"$thin_type"-"$arch"/usr/share/firefox-esr/distribution/policies.json
-{
-  "policies": {
-    "Certificates": {
-      "ImportEnterpriseRoots": true,
-      "Install": [
-        "/etc/ssl/certs/Debian-Edu_rootCA.crt"
-      ]
-    },
-    "NewTabPage": false,
-    "OverrideFirstRunPage": "",
-    "SearchEngines": {
-      "Add": [
-        {
-          "IconURL": "https://duckduckgo.com/favicon.ico",
-          "Method": "POST",
-          "Name": "DuckDuckGo",
-          "SuggestURLTemplate": "https://duckduckgo.com/ac/?q={searchTerms}&type=list",
-          "URLTemplate": "https://duckduckgo.com/?q={searchTerms}"
-        }
-      ],
-      "Default": "DuckDuckGo"
-    }
-  }
-}
-EOF
-	fi
-
-	if [ "$img" == "yes" ] ; then
-		ltsp image /srv/ltsp/x2go-"$thin_type"-"$arch"
-	fi
-
-	# Create a runtime user for x2go login terminal; configure autofs (USB storage support).
-	if [ "bare" == "$thin_type" ] ; then
-		cat <<EOF >> /etc/ltsp/ltsp.conf
-POST_INIT_THIN_USER='useradd -G disk -m -d /run/home/thin -k /etc/ltsp/skel -r thin'
-
-POST_INIT_SYSTEMD='mkdir /etc/systemd/system/getty at tty1.service.d && \
-cp /etc/ltsp/getty at tty1.service.d/override.conf /etc/systemd/system/getty at tty1.service.d'
-
-POST_INIT_AUTOFS='cp /etc/ltsp/autofs/extra.autofs /etc/auto.master.d && \
-cp /etc/ltsp/autofs/auto.* /etc'
-EOF
-	fi
-
-	ALL_IMAGES=1 ltsp kernel
-	# Create the ltsp.img file and move it to where it belongs.
-	ltsp initrd
-	mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/x2go-"$thin_type"-"$arch"/ltsp.img
-
-	# Clean up ltsp.conf from image specific items.
-	sed -i '/POST_INIT/d' /etc/ltsp/ltsp.conf
+# Source snippets from debian-edu-config LTSP installer's postinst directory.
+if [ -n "$(find ${ltsp_postinst_dir} -mindepth 1 -maxdepth 1 -type f)" ]; then
+	for postinst_file in "${ltsp_postinst_dir}"/[0-9][0-9]_{common,${install_variant}}_*.sh; do
+		source "${postinst_file}"
+	done
 fi
 
-# Generate image for diskless workstation.
-if [ "yes" == "$diskless_workstation"  ] ; then
-	if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
-		# The image is a copy of the main server's fs. On the server, autofs
-		# is disabled, but it is needed for diskless workstations.
-		# OTOH some services need to be disabled, i.e. 'masked'.
-		cat <<EOF >> /etc/ltsp/ltsp.conf
-PRE_INIT_AUTOFS="echo 'LDAPURI=ldap://ldap' >> /etc/default/autofs"
-PRE_INIT_MAIN_SERVER="systemctl enable autofs"
-POST_INIT_USE_FQDN="sed -i '/10.0.2.2/ s/server/tjener.intern tjener/' /etc/hosts"
-POST_INIT_SITESUMMARY="sed -i 's/main-server/ltsp-client/' /etc/sitesummary/hostclass"
-MASK_SYSTEM_SERVICES="apache2 named cups dovecot etckeeper exim4 squid tftpd-hpa \
-icinga2 nmbd slapd smbd systemd-journald xrdp xrdp-sesman krb5-kdc mariadb cfengine3 isc-dhcp-server"
-EOF
-	else
-		cat <<EOF >> /etc/ltsp/ltsp.conf
-MASK_SYSTEM_SERVICES="etckeeper exim4 tftpd-hpa isc-dhcp-server xrdp xrdp-sesman"
-EOF
-	fi
-	# Temporary workaround needed in some cases for configuring the resolver inside
-	# the SquashFS image.
-	rm -f /etc/resolv.conf
-	echo "nameserver $dns_server" > /etc/resolv.conf
-	echo "search intern" >> /etc/resolv.conf
-	# Temporary workaround needed to turn DLW images into machines of profile type 'Workstation'
-	sed -i /etc/debian-edu/config -e "s/^PROFILE=.*/PROFILE=\"Workstation\"/g"
-	# Create SquashFS image.
-	ltsp image /,,/boot,subdir=boot,,/usr,subdir=usr,,/var,subdir=var
-	# Revert resolver workaround from above.
-	rm -f /etc/resolv.conf
-	ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
-	# Revert temporary change to PROFILE in /etc/debian-edu/config
-	sed -i /etc/debian-edu/config -e "s/^PROFILE=.*/PROFILE=\"${PROFILE}\"/g"
-	# next modification avoids ltsp command error if lot of images are available.
-	ALL_IMAGES=1 ltsp kernel
-	ltsp initrd
-	if uname -r | grep -q 686 ; then
-		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/x86_32/ltsp.img
-	else
-		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/"$(uname -m)"/ltsp.img
-	fi
-	# Clean up ltsp.conf from specific items.
-	sed -i '/PRE_INIT_MAIN/d' /etc/ltsp/ltsp.conf
-	sed -i '/PRE_INIT_AUTOFS/d' /etc/ltsp/ltsp.conf
-	sed -i '/MASK_SYSTEM/d' /etc/ltsp/ltsp.conf
-fi
+# Configure NFS
+if [ "${configure_ltsp_nfs}" = "true" ]; then
 
-# Generate chroot and SquashFS image (optional) for diskless workstation.
-if [ "yes" == "$dlw"  ] ; then
-	# The chroot is basically a workstation installation.
-	# Petter Reinholdtsen's debian-edu-bless script is used to achieve it.
-	cat <<EOF >> /etc/ltsp/ltsp.conf
-LIGHTDM_CONF="greeter-hide-users"
-POST_INIT_USE_FQDN="sed -i '/10.0.2.2/ s/server/tjener.intern tjener/' /etc/hosts"
-EOF
-	mkdir -p /srv/ltsp/dlw
-	chmod 755 /srv/ltsp/dlw
-	# Install base system
-	debootstrap --arch="$arch" --no-check-gpg --variant=minbase --include=locales,console-setup,linux-image-"$kernel_arch" "$dist" /srv/ltsp/dlw "$mirror"
-	# Unset temporary directory variables to avoid problems when directory
-	# is missing inside the chroot. https://bugs.debian.org/765443
-	unset TMPDIR TEMP TEMPDIR TMP
-	chroot /srv/ltsp/dlw/ apt clean
-	# Care for complete sources list (security, also nonfree -- in case firmware is needed).
-	if [ -e /srv/ltsp/dlw/usr/share/doc/apt/examples/sources.list ] ; then
-		# Up to bookworm
-		chroot /srv/ltsp/dlw/ sh -c "cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list.d/full.list"
-	else
-		# Since trixie
-		chroot /srv/ltsp/dlw/ sh -c "cp /usr/share/doc/apt/examples/debian.sources /etc/apt/sources.list.d/debian_full.sources"
-	fi
-	mount /dev/pts -t devpts /srv/ltsp/dlw/dev/pts
-	mount proc -t proc /srv/ltsp/dlw/proc
-	if [ "true" == "$BD_ISO" ] ; then
-		mkdir -p /srv/ltsp/dlw/media/cdrom
-		mount /media/cdrom /srv/ltsp/dlw/media/cdrom -o bind
-		echo "deb [trusted=yes] $mirror $dist main" > /srv/ltsp/dlw/etc/apt/sources.list
+	# Adjust NFS exports for separate LTSP servers.
+	if ! echo "$PROFILE" | grep -Eq 'Main-Server' ; then
+		# This file is only needed on Main-Server and will break
+		# NFS server on non-Main-Server systems.
+		rm -f /etc/exports.d/edu.exports
 	fi
 
-	# Care for same locale and keyboard settings in the chroot, also useful to quiet down Perl.
-	cp /etc/locale.gen /srv/ltsp/dlw/etc/
-	cp /etc/default/locale /srv/ltsp/dlw/etc/default
-	chroot /srv/ltsp/dlw locale-gen
-	cp /etc/default/keyboard /srv/ltsp/dlw/etc/default
-	cp /etc/default/console-setup /srv/ltsp/dlw/etc/default
-	chroot /srv/ltsp/dlw setupcon -k
-
-	# Care for special files.
-	mkdir -p /srv/ltsp/dlw/tmp/user/0/
-	cp /usr/share/debian-edu-config/tools/debian-edu-bless /srv/ltsp/dlw/sbin
-
-	# Install the mandatory ltsp package (and apt-utils to don't delay package configuration).
-	chroot /srv/ltsp/dlw apt-get install -y -qq apt-utils ltsp
-
-	# Turn system into a Debian Edu workstation.
-	chroot /srv/ltsp/dlw sh -c "PROFILE=Workstation DESKTOP=$desktop /sbin/debian-edu-bless"
-	mkdir -p /srv/ltsp/dlw/skole
-	chmod 755 /srv/ltsp/dlw/skole
-	rm -f /srv/ltsp/dlw/etc/resolv.conf
-	# Next line needed for kerberized NFS home directory access.
-	cp /etc/krb5.keytab /srv/ltsp/dlw/etc/
-	# Care for Debian Edu certificates.
-	cp /etc/ssl/certs/debian-edu-server.crt /srv/ltsp/dlw/etc/ssl/certs/
-	cp /usr/local/share/ca-certificates/*.crt /srv/ltsp/dlw/usr/local/share/ca-certificates/
-	chroot /srv/ltsp/dlw update-ca-certificates
-	# Adjust Sitesummary configuration
-	cp -f /etc/sitesummary/site /srv/ltsp/dlw/etc/sitesummary/
-	cp -f /etc/sitesummary/sitegroup /srv/ltsp/dlw/etc/sitesummary/
-	echo ltsp-client > /srv/ltsp/dlw/etc/sitesummary/hostclass
-
-	# Care for temporary mounts.
-	umount /srv/ltsp/dlw/dev/pts
-	umount /srv/ltsp/dlw/proc
-	if [ "true" == "$BD_ISO" ] ; then
-		umount /srv/ltsp/dlw/media/cdrom
-	fi
+	ltsp nfs
 
-	# Create optional SquashFS image file.
-	if [ "yes" == "$img"  ] ; then
-		ltsp image dlw
+	# Restart nfs-kernel-server and give feedback about exports if running this
+	# script outside of the Debian Installer environment.
+	if [ ! -x /sbin/start-stop-daemon.REAL ] ; then
+		exportfs -rav
 	fi
-
-	# Next modification avoids ltsp command error if lot of images are available.
-	ALL_IMAGES=1 ltsp kernel
-
-	# Create ltsp initrd (ltsp.img) and move it to the right location.
-	ltsp initrd
-	mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/dlw/
-
-	# Update iPXE menu and adjust the created file for Debian Edu needs.
-	ltsp ipxe
-	sed -i 's#ltsp/ltsp.img#ltsp/${img}/ltsp.img#' /srv/tftp/ltsp/ltsp.ipxe
-
-	# Clean up ltsp.conf from image specific items.
-	sed -i '/POST_INIT/d' /etc/ltsp/ltsp.conf
-	sed -i '/LIGHTDM_CONF/d' /etc/ltsp/ltsp.conf
-fi
-
-# Get rid of additional excludes just in case they exist (main server).
-cat /dev/null > /etc/ltsp/image-local.excludes
-
-# Use legacy network interfaces names.
-if ! grep -q net.ifnames /etc/default/grub ; then
-    sed -i 's/quiet/net.ifnames=0 quiet/' /etc/default/grub
-    update-grub
-fi
-
-# Tweak network interfaces file to match the use case.
-if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
-	cat <<EOF > /etc/network/interfaces
-auto eth0 eth1
-iface eth0 inet static
-	address 10.0.2.2
-	gateway 10.0.0.1
-	dns-search intern
-	dns-nameserver 127.0.0.1
-
-iface eth1 inet static
-	address $ETH1_IP
-EOF
-	else
-	cat <<EOF > /etc/network/interfaces
-auto eth0 eth1
-iface eth0 inet static
-	address $ETH0_IP
-	gateway 10.0.0.1
-	dns-search intern
-	dns-nameservers 10.0.2.2
-
-iface eth1 inet static
-	address $ETH1_IP
-EOF
-fi
-
-# Next line is needed upon upgrade from LTSP5.
-sed -i '/ltsp/d' /etc/exports
-
-# Adjust NFS exports for separate LTSP servers.
-if ! echo "$PROFILE" | grep -Eq 'Main-Server' ; then
-	rm -f /etc/exports.d/edu.exports
-fi
-
-# Configure NFS
-ltsp nfs
-
-# Restart nfs-kernel-server and give feedback about exports if running this
-# script outside of the Debian Installer environment.
-if [ ! -x /sbin/start-stop-daemon.REAL ] ; then
-	exportfs -rav
 fi
 
 # Generate the LTSP specific iPXE menu
-ltsp ipxe
-
-# Add PXE installation related entries to iPXE menu.
-if ! grep -q main-server /srv/tftp/ltsp/ltsp.ipxe && \
-    [ -f /srv/tftp/debian-installer/amd64/linux ] ; then
-	echo "Modifying /srv/tftp/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 /srv/tftp/debian-edu/install.cfg >>/srv/tftp/ltsp/ltsp.ipxe
-fi
-
-# Make sure /srv/tftp/ltsp/ltsp.ipxe is Debian Edu specific.
-sed -i "s#ltsp/ltsp.img#ltsp/${img}/ltsp.img#" /srv/tftp/ltsp/ltsp.ipxe
-# Add "quiet" and "splash" parameters to hide kernel logs on a boot screen.
-sed -i "s/set cmdline ${cmdline_method} ${cmdline_ltsp} ${cmdline_client}$/set cmdline ${cmdline_method} ${cmdline_ltsp} ${cmdline_client} ${KERNEL_PARAMETERS}/" /srv/tftp/ltsp/ltsp.ipxe
-
-# Unmount the BD image, if it was mounted at the start of this script.
-if [ "yes" == "$bd_iso_was_mounted" ] ; then
-	umount /media/cdrom
+if [ "${configure_ltsp_ipxe}" = "true" ]; then
+	debian-edu-ltsp-ipxe
 fi


=====================================
sbin/debian-edu-ltsp-ipxe
=====================================
@@ -12,7 +12,6 @@ if ! grep -q main-server /srv/tftp/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 /srv/tftp/debian-edu/install.cfg >>/srv/tftp/ltsp/ltsp.ipxe



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/882a5130b1b5c78a00158aae125c356fc67eea3a

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/882a5130b1b5c78a00158aae125c356fc67eea3a
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/20261015/ecb47f12/attachment-0001.htm>


More information about the debian-edu-commits mailing list