[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] Improve LTSP related maintenance

Wolfgang Schweer (@schweer-guest) gitlab at salsa.debian.org
Fri Nov 12 12:09:49 GMT 2021



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


Commits:
d6e91cb7 by Wolfgang Schweer at 2021-11-12T10:47:32+01:00
Improve LTSP related maintenance

  sbin/debian-edu-ltsp-initrd: New tool. This is a wrapper script for the
  'ltsp initrd' command. It makes sure that a use case specific initrd
  (/srv/tftp/ltsp/ltsp.img) is generated and moved to the right location.

  share/man/man8/debian-edu-ltsp-initrd.8: New manual page.

  share/man/man8/debian-edu-ltsp-ipxe.8: Improve manual page content.

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

- - - - -


5 changed files:

- Makefile
- debian/changelog
- + sbin/debian-edu-ltsp-initrd
- + share/man/man8/debian-edu-ltsp-initrd.8
- share/man/man8/debian-edu-ltsp-ipxe.8


Changes:

=====================================
Makefile
=====================================
@@ -8,6 +8,7 @@ PROGS = \
 SPROGS = debian-edu-fsautoresize \
 	debian-edu-ltsp-chroot \
 	debian-edu-ltsp-install \
+	debian-edu-ltsp-initrd \
 	debian-edu-ltsp-ipxe \
 	debian-edu-pxeinstall \
 	debian-edu-restart-services \


=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+debian-edu-config (2.12.13) UNRELEASED; urgency=medium
+
+  * Improve LTSP related maintenance:
+    - sbin/debian-edu-ltsp-initrd: New tool. This is a wrapper script for the
+      'ltsp initrd' command. It makes sure that a use case specific initrd
+      (/srv/tftp/ltsp/ltsp.img) is generated and moved to the right location.
+    - share/man/man8/debian-edu-ltsp-initrd.8: New manual page.
+    - share/man/man8/debian-edu-ltsp-ipxe.8: Improve manual page content.
+
+ -- Wolfgang Schweer <wschweer at arcor.de>  Fri, 12 Nov 2021 09:55:40 +0100
+
 debian-edu-config (2.12.12) unstable; urgency=medium
 
   [ Wolfgang Schweer ]


=====================================
sbin/debian-edu-ltsp-initrd
=====================================
@@ -0,0 +1,126 @@
+#!/bin/bash
+#
+# Debian Edu specific replacement for 'ltsp initrd' command.
+# Author/Copyright:	Wolfgang Schweer <wschweer at arcor.de>
+# Licence:		GPL2+
+# first edited:	2021-11-10
+
+version=2021-11-11
+
+set -e
+
+usage() {
+	cat <<EOF
+Usage: $0 command
+
+Update specific LTSP initrd file (ltsp.img) for each use case. This needs to be
+done after the /etc/ltsp/ltsp.conf clients section has been modified.
+
+Options:
+	--help     Display the debian-edu-ltsp-initrd help message.
+	--version  Output version information and exit.
+EOF
+}
+
+thin() {
+	type="$1"
+	# Add specific configuration.
+	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
+	# Create the ltsp.img file and move it to the right location.
+	echo "Updating LTSP initrd for $type:"
+	ltsp initrd
+	mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/"$type"/ltsp.img
+	echo "Moved /srv/tftp/ltsp/ltsp.img to /srv/tftp/ltsp/$type/"
+
+	# Clean up ltsp.conf from image specific items.
+	sed -i '/POST_INIT/d' /etc/ltsp/ltsp.conf
+}
+
+dlw() {
+	# Add specific configuration.
+	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
+	# Create the ltsp.img file and move it to the right location.
+	echo "Updating LTSP initrd for dlw:"
+	ltsp initrd
+	mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/dlw/
+	echo "Moved /srv/tftp/ltsp/ltsp.img to /srv/tftp/ltsp/dlw/"
+
+	# 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
+}
+
+server() {
+
+	# Add specific configuration.
+	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
+	# Update the ltsp.img file and move it to the right location.
+	echo "Updating LTSP initrd for use with the server's filesystem:"
+	ltsp initrd
+	if uname -r | grep -q 686 ; then
+		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/x86_32/ltsp.img
+		echo "Moved /srv/tftp/ltsp/ltsp.img to /srv/tftp/ltsp/x86_32/"
+	else
+		mv /srv/tftp/ltsp/ltsp.img /srv/tftp/ltsp/"$(uname -m)"/ltsp.img
+		echo "Moved /srv/tftp/ltsp/ltsp.img to /srv/tftp/ltsp/x86_64/"
+	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
+}
+
+case "$1" in
+	-h|--help) usage ; exit 0 ;;
+	--version) echo $version ; exit 0 ;;
+esac
+
+# Make Debian Edu profile available.
+if [ -r /etc/debian-edu/config ] ; then
+	. /etc/debian-edu/config
+fi
+
+# LTSP images base directory
+BASE="/srv/tftp/ltsp"
+
+if [ -d "$BASE"/x86_64 ] || [ -d "$BASE"/x86_32 ]; then server ; fi
+if [ -d "$BASE"/dlw ] ; then dlw ; fi
+
+# X2Go thin client variants.
+variants="bare-amd64 display-amd64 desktop-amd64 bare-i386 display-i386 desktop-i386"
+
+for i in $variants ; do
+    if [ -d $BASE/x2go-"$i" ] ; then thin x2go-"$i" ; fi
+done
+
+case "$1" in
+	-h|--help) usage ; exit 0 ;;
+	--version) echo $version ; exit 0 ;;
+	*) exit 0 ;;
+esac


=====================================
share/man/man8/debian-edu-ltsp-initrd.8
=====================================
@@ -0,0 +1,13 @@
+.TH DEBIAN-EDU-LTSP-INITRD 8 "November 2021" "Debian Edu" "Debian Edu Admin Tools"
+
+.SH NAME
+debian-edu-ltsp-initrd - update the ltsp.img file on a Debian Edu LTSP server for each use case
+
+.SH SYNOPSIS
+.B debian-edu-ltsp-initrd
+
+.SH DESCRIPTION
+This is a wrapper script for the 'ltsp initrd' command. It makes sure that a use case specific initrd (/srv/tftp/ltsp/ltsp.img) is generated and then moved to the use case related directory. The command needs to be run after the /etc/ltsp/ltsp.conf [clients] section has been modified.
+
+.SH AUTHORS
+Debian Edu Team, https://blends.debian.org/edu


=====================================
share/man/man8/debian-edu-ltsp-ipxe.8
=====================================
@@ -1,13 +1,13 @@
-.TH DEBIAN-EDU-LTSP-IPXE 8 "September 2021" "Debian Edu" "Debian Edu User Tools"
+.TH DEBIAN-EDU-LTSP-IPXE 8 "November 2021" "Debian Edu" "Debian Edu Admin Tools"
 
 .SH NAME
-debian-edu-ltsp-ipxe - generate or update the iPXE menu file on a Debian Edu LTSP server
+debian-edu-ltsp-ipxe - update the iPXE menu file on a Debian Edu LTSP server
 
 .SH SYNOPSIS
 .B debian-edu-ltsp-ipxe
 
 .SH DESCRIPTION
-This is a wrapper script for the 'ltsp ipxe' command. It makes sure that the /srv/tftp/ltsp/ltsp.ipxe file is Debian Edu specific.
+This is a wrapper script for the 'ltsp ipxe' command. It makes sure that the /srv/tftp/ltsp/ltsp.ipxe file is Debian Edu specific. The command needs to be run after iPXE menu related items (like menu timeout or default boot settings) in the /etc/ltsp/ltsp.conf [server] section have been modified.
 
 .SH AUTHORS
 Debian Edu Team, https://blends.debian.org/edu



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

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/commit/d6e91cb7f2f539fed204d7d61c0bf815c6aefe76
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/20211112/e74d0a0b/attachment-0001.htm>


More information about the debian-edu-commits mailing list