[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] 3 commits: Improve sbin/debian-edu-ltsp-install

Wolfgang Schweer (@schweer-guest) gitlab at salsa.debian.org
Sun Sep 19 23:56:07 BST 2021



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


Commits:
8ee35ec4 by Wolfgang Schweer at 2021-09-20T00:47:37+02:00
Improve sbin/debian-edu-ltsp-install

 Add LTSP diskless workstation chroot installation as additional option.
 Add some more inline documentation.

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

- - - - -
1c597fab by Wolfgang Schweer at 2021-09-20T00:52:12+02:00
Adjust share/d-e-c/tools/debian-edu-bless to be easier usable with the 'debian-edu-ltsp-install' script

 Update the list of supported desktop environments, use xfce as default.

 Support 'none' as an option to above list just in case someone decides to
 not install a desktop environment by default (modular installation).

 Use cf-agent in verbose mode for better readable logging.

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

- - - - -
5615a2ea by Wolfgang Schweer at 2021-09-20T00:55:06+02:00
Update share/man/man8/debian-edu-ltsp-install.8

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

- - - - -


4 changed files:

- debian/changelog
- sbin/debian-edu-ltsp-install
- share/debian-edu-config/tools/debian-edu-bless
- share/man/man8/debian-edu-ltsp-install.8


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,18 @@
+debian-edu-config (2.12.3) UNRELEASED; urgency=medium
+
+  * Improve sbin/debian-edu-ltsp-install:
+    - Add LTSP diskless workstation chroot installation as additional option.
+    - Add some more inline documentation.
+  * Adjust share/d-e-c/tools/debian-edu-bless to be easier usable with the
+   'debian-edu-ltsp-install' script:
+    - Update the list of supported desktop environments, use xfce as default.
+    - Support 'none' as an option to above list just in case someone decides to
+      not install a desktop environment by default (modular installation).
+    - Use cf-agent in verbose mode for better readable logging.
+  * Update share/man/man8/debian-edu-ltsp-install.8 to match the changes..
+
+ -- Wolfgang Schweer <wschweer at arcor.de>  Fri, 17 Sep 2021 16:04:42 +0200
+
 debian-edu-config (2.12.2) unstable; urgency=medium
 
   [ Wolfgang Schweer ]


=====================================
sbin/debian-edu-ltsp-install
=====================================
@@ -11,13 +11,13 @@
 # backbone network with two NICs. This system needs to be registered w/ GOsa² in
 # case it isn't the main server (i.e. a 'combined' server).
 # Kerberized NFS is used (with krb5i as default), see:
-# https://wiki.debian.org/DebianEdu/Documentation/Bullseye/HowTo/Administration#Kerberized_NFS
+# 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
-# last edited:	2021-09-14
+# last edited:	2021-09-19
 
 set -e
 
@@ -32,19 +32,27 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
 
 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>
+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>
 
 Turn a Debian Edu workstation into an LTSP server for both diskless
 workstations and thin clients.
 
 --arch       takes effect for a thin client chroot setup, default value is the system architecture one.
 
---dist       takes effect for a thin client chroot setup, default value is the one the LTSP server is running.
+--dist       takes effect for a LTSP/X2Go client chroot setup, default value is the one the LTSP server is running.
 
---dns_server defaults to 10.0.2.2 if unset.
+--dns_server defaults to 10.0.2.2 if omitted.
 
 --diskless_workstation defaults to yes if omitted.
 
+--dlw        used to create a diskless workstation LTSP chroot (root fs via NFS), default is no.
+
+--img        takes effect for LTSP diskless workstation chroot setup, default is no.
+
+--desktop    takes effect for a 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).
+
 --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.
@@ -52,9 +60,21 @@ workstations and thin clients.
     desktop: x2gothinclient running in minidesktop mode.
 
 Example 1: 'debian-edu-ltsp-install --arch amd64' creates diskless workstation support.
-Example 2: 'debian-edu-ltsp-install --arch amd64 --dist bullseye --thin_type bare' creates diskless workstation and 64-bit thin client support.
-            LTSP client boot defaults to diskless workstation.
-Example 3: 'debian-edu-ltsp-install --arch i386 --diskless_workstation no --thin_type bare' creates additional 32-bit thin client support. 
+
+Example 2: 'debian-edu-ltsp-install --arch amd64 --dist bullseye --thin_type bare' creates diskless workstation
+            and 64-bit thin client support. LTSP client boot defaults to diskless workstation.
+
+Example 3: 'debian-edu-ltsp-install --arch i386 --diskless_workstation no --thin_type bare' creates
+            additional 32-bit thin client support.
+
+Example 4: 'debian-edu-ltsp-install --diskless_workstation yes' updates the diskless workstation SquashFS image.
+
+Example 5: 'debian-edu-ltsp-install --dlw yes --diskless_workstation 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
+            'lvresize -L+15G /dev/vg_system/srv+ltsp' and 'resize2fs /dev/vg_system/srv+ltsp'.
+
+Example 6: 'debian-edu-ltsp-install --dlw yes --diskless_workstation no --img yes' creates diskless workstation
+            LTSP chroot and the related SquashFS image. About 5 GiB more additional disk space is needed.
 
 This script applies to a system with two NICs on the internal backbone network.
 
@@ -77,6 +97,9 @@ arch="$(dpkg --print-architecture)"
 dns_server="10.0.2.2"
 diskless_workstation="yes"
 thin_type=""
+dlw="no"
+img="no"
+desktop="xfce"
 
 while [ $# -gt 0 ] ; do
   case "$1" in
@@ -85,12 +108,16 @@ while [ $# -gt 0 ] ; do
     --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 ;;
   esac
   shift
 done
 
 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.
@@ -140,6 +167,11 @@ IPXE_X86_64_IMG="Diskless Workstation (64-Bit)"
 # Provide a full menu name for x86_32.img
 IPXE_X86_32_IMG="Diskless Workstation (32-Bit)"
 
+# Provide a full menu name for dlw.img
+IPXE_DLW_IMG="Diskless Workstation (chroot SquashFS image)"
+# Provide a full menu name for dlw
+IPXE_DLW="Diskless Workstation (chroot NFS rootfs)"
+
 ##### Set default boot value ######
 # Default value is x86_64 or x86_32 (arch specific, Diskless Workstation)
 # Plain X2Go Thin Client (64-Bit)
@@ -502,7 +534,7 @@ icinga2 nmbd slapd smbd systemd-journald xrdp xrdp-sesman krb5-kdc mariadb cfeng
 EOF
 	else
 		cat <<EOF >> /etc/ltsp/ltsp.conf
-MASK_SYSTEM_SERVICES="etckeeper exim4 tftpd-hpa isc-dhcp-server xrdp"
+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
@@ -529,9 +561,96 @@ EOF
 	sed -i '/MASK_SYSTEM/d' /etc/ltsp/ltsp.conf
 fi
 
+# 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
+	# Use BD-ISO if available.
+	if ! mountpoint -q /media/cdrom ; then
+		mount /media/cdrom
+	fi
+	if grep -q BD /etc/apt/sources.list && [ -f /media/cdrom/.disk/info ] ; then
+		mkdir -p /srv/ltsp/dlw/media/cdrom
+		mount --bind /media/cdrom /srv/ltsp/dlw/media/cdrom
+		mirror="file:///media/cdrom/"
+	fi
+	# Install base system
+	debootstrap --arch="$arch" --no-check-gpg --variant=minbase --include=locales,console-setup,linux-image-"$arch" "$dist" /srv/ltsp/dlw "$mirror"
+
+	# 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.
+	mount /dev/pts -t devpts /srv/ltsp/dlw/dev/pts
+	mount proc -t proc /srv/ltsp/dlw/proc
+	mount tmpfs -t tmpfs /srv/ltsp/dlw/tmp
+	if mountpoint -q /media/cdrom ; then
+		echo "deb [trusted=yes] "$mirror" "$dist" main" > /srv/ltsp/dlw/etc/apt/sources.list
+	fi
+	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 "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
+
+	# Care for temporary mounts.
+	umount /srv/ltsp/dlw/dev/pts
+	umount /srv/ltsp/dlw/proc
+	umount /srv/ltsp/dlw/tmp
+	if [ -f /media/cdrom/.disk/info ] ; then
+		umount /srv/ltsp/dlw/media/cdrom
+		umount /media/cdrom
+	fi
+
+	# Care for sources.list in dlw chroot in case of package upgrades.
+	cat /usr/share/doc/apt/examples/sources.list >> /srv/ltsp/dlw/etc/apt/sources.list
+
+	# Create optional SqashFS image file.
+	if [ "yes" == "$img"  ] ; then
+		ltsp image dlw
+	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).
-rm -rf /etc/ltsp/image-local.excludes
-touch /etc/ltsp/image-local.excludes
+cat /dev/null > /etc/ltsp/image-local.excludes
 
 # Use legacy network interfaces names.
 if ! grep -q net.ifnames /etc/default/grub ; then


=====================================
share/debian-edu-config/tools/debian-edu-bless
=====================================
@@ -1,9 +1,9 @@
 #!/bin/sh
 #
-# This is an example script that explain what need to be done to
+# This is an example script that explains what needs to be done to
 # transform a freshly installed Debian machine (hopefully without any
 # of the Debian Edu related packages already installed) to a Debian
-# Edu client.  The packages that was already installed before running
+# Edu client. The packages that were already installed before running
 # this script might not get the configuration they would have in a
 # normal Debian Edu installation, due to preseeding happening too
 # late.
@@ -13,6 +13,9 @@
 #   PROFILE=Main-Server,Workstation \
 #     DESKTOP=gnome,lxde \
 #     ./debian-edu-bless
+# Use DESKTOP=none for modular installations. In this case, only the
+# 'education-desktop-other' package will be installed in case the Workstation
+# profile has been chosen.
 
 set -e
 set -x
@@ -37,8 +40,8 @@ export SUDO_FORCE_REMOVE=yes
 PROFILE="${PROFILE:-Workstation}"
 
 # Desktop environment to use.  Can include several comma separated values.
-# Valid values are currently kde, gnome, lxde, xfce
-DESKTOP="${DESKTOP:-kde}"
+# Valid values are currently kde, gnome, lxde, xfce, mate, lxqt, cinnamon, and none.
+DESKTOP="${DESKTOP:-xfce}"
 
 # LANG is the locale to use (should be configured using
 # dpkg-reconfigure locales), and LANGUAGE is the ordered set of
@@ -56,7 +59,7 @@ fi
 # Any version string will do.  If an old and official version string
 # like terra_alpha is used, it will be replaced by debian-edu-install
 # during installation to the current version.
-VERSION="terra_alpha"
+VERSION="10+edu0"
 
 # Replace false with true if you want to run the testsuite after first boot.
 TESTINSTALL="false"
@@ -107,10 +110,17 @@ apt_get_harder "apt-get install -y debian-edu-install"
 #    /etc/debian-edu/config, and run tasksel to install packages
 #    according to the profile specified in the config above,
 #    overriding some of the Debian automation machinery.
-(
-    echo debian-edu-install debian-edu-install/profile multiselect "$PROFILE"
-    echo tasksel            tasksel/desktop            string      "$DESKTOP"
-) | debconf-set-selections
+#    Allow using 'none' if desktop installation isn't wanted.
+if [ "none" = "$DESKTOP" ] ; then
+	(
+		echo debian-edu-install debian-edu-install/profile multiselect "$PROFILE"
+	) | debconf-set-selections
+else
+	(
+	    echo debian-edu-install debian-edu-install/profile multiselect "$PROFILE"
+	    echo tasksel            tasksel/desktop            string      "$DESKTOP"
+	) | debconf-set-selections
+fi
 /usr/lib/education-tasks/edu-tasksel-setup setup
 
 DEBIAN_FRONTEND=noninteractive
@@ -130,10 +140,10 @@ else
     exit 1
 fi
 
-# 4. Run 'cf-agent -D installation' to configure everything
-#    that could not be done using preseeding.
-cf-agent -I -D installation
-etckeeper commit "/etc/ state after running cf-agent -D installation." || true
+# 4. Run cf-agent in verbose mode w/ installation class definition to configure
+#    everything that could not be done using preseeding.
+cf-agent -v -D installation
+etckeeper commit "/etc/ state after running cf-agent -v -D installation." || true
 
 # 5. Ask for a reboot to enable all the configuration changes.
 echo "It is now time to reboot. For example by running"


=====================================
share/man/man8/debian-edu-ltsp-install.8
=====================================
@@ -19,14 +19,23 @@ These are the options that can appear on the command line:
 takes effect for a thin client chroot setup, default value is the system architecture one
 .TP
 \fB\--dist\ <stable|testing|sid>\fR
-takes effect for a thin client chroot setup, default value is the one the LTSP server is running
+takes effect for a LTSP/X2Go client chroot setup, default value is the one the LTSP server is running
 .TP
 \fB\--dns_server\ <10.0.2.2|dns\ server\ ip>\fR
-defaults to 10.0.2.2 if option is omitted
+--dns_server defaults to 10.0.2.2 if omitted
 .TP
 \fB\--diskless_workstation\ <yes|no>\fR
 defaults to yes if option is omitted
 .TP
+\fB\--dlw\ <yes|no>\fR
+used to create a diskless workstation LTSP chroot (root fs via NFS), default is no
+.TP
+\fB\--img\ <yes|no>\fR
+takes effect for LTSP diskless workstation chroot setup, default is no
+.TP
+\fB\--desktop\<xfce|cinnamon|gnome|kde|lxde|lxqt|mate|none> \fR
+takes effect for LTSP diskless workstation chroot setup, default is xfce
+.TP
 \fB\--thin_type\ <bare|display|desktop>\fR
 .TP
        no default value, these are available:
@@ -52,8 +61,23 @@ creates diskless workstation and 64-bit thin client support, the LTSP client
 boot defaults to diskless workstation.
 .TP
 .B debian-edu-ltsp-install --arch i386 --diskless_workstation no --thin_type bare
-.TQ 
+.TQ
 creates additional 32-bit thin client support
+.TP
+.B debian-edu-ltsp-install --diskless_workstation yes
+.TQ
+updates the diskless workstation SquashFS image
+.TP
+.B debian-edu-ltsp-install --dlw yes --diskless_workstation no
+.TQ
+creates a diskless workstation LTSP chroot. About 15 GiB additional disk space is needed. In the default case, run the commands
+.B lvresize -L+15G /dev/vg_system/srv+ltsp
+and
+.B resize2fs /dev/vg_system/srv+ltsp
+.TP
+.B debian-edu-ltsp-install --dlw yes --img yes --diskless_workstation no
+.TQ
+creates a diskless workstation LTSP chroot and the related SquashFS image. About even 5 GiB more additional diskspace is needed.
 
 .SH AUTHORS
 Debian Edu Team, https://blends.debian.org/edu



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/8fe4166d4c55fd4cc9c2cbd4b306b2d984b40cf9...5615a2ea7aef5a963f7248efc82da8b374101ccb

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/8fe4166d4c55fd4cc9c2cbd4b306b2d984b40cf9...5615a2ea7aef5a963f7248efc82da8b374101ccb
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/20210919/18396a18/attachment-0001.htm>


More information about the debian-edu-commits mailing list