[debian-edu-commits] [Git][debian-edu/debian-edu-config][personal/sunweaver/mailbox-init-first-user] 3 commits: share/debian-edu-config/tools/run-at-firstboot: Add an environment check to...

Mike Gabriel (@sunweaver) gitlab at salsa.debian.org
Fri Sep 4 22:24:18 BST 2026



Mike Gabriel pushed to branch personal/sunweaver/mailbox-init-first-user at Debian Edu / debian-edu-config


Commits:
c2ba0299 by Serhii Horichenko at 2026-09-04T19:26:12+02:00
share/debian-edu-config/tools/run-at-firstboot: Add an environment check to avoid starting the image creation on an LTSP-client (Closes: #1092123).

- - - - -
8b5765b6 by Serhii Horichenko at 2026-09-04T19:40:06+02:00
share/debian-edu-config/tools/run-at-firstboot: Add an ability to create a Diskless Workstation chroot and separate the creation of an image on an LTSP-server without the Main-Server role (Closes: #1092123).

- - - - -
e1bef19f by Mike Gabriel at 2026-09-04T21:24:16+00:00
run-at-firstboot: Initialize first user's mailbox only when logging into Main-Server

- - - - -


1 changed file:

- share/debian-edu-config/tools/run-at-firstboot


Changes:

=====================================
share/debian-edu-config/tools/run-at-firstboot
=====================================
@@ -26,6 +26,14 @@ at_exit() {
 	error "script $0 terminated unexpectedly."
 }
 disable_exception() { trap - INT TERM EXIT; }
+is_ltsp_client() {
+        if grep -q "initrd=ltsp.img" < /proc/cmdline; then
+                return 0
+        else
+                return 1
+        fi
+}
+
 trap at_exit INT TERM EXIT
 
 info "Executing run-at-firstboot script."
@@ -62,9 +70,23 @@ fi
 # information from some daemons isn't available during installation. It's done
 # for a combined server but not for a separate LTSP server because the image
 # needs to include the krb5.keytab file which isn't available at this time.
-if echo "$PROFILE" | grep -Eq 'Main-Server.*LTSP-Server' && \
-	[ ! -f /srv/ltsp/images/$ltspimg ] ; then
-	/usr/sbin/debian-edu-ltsp-install --diskless_workstation yes
+if ! is_ltsp_client; then
+	# If this runs on a combi server (Main-Server + LTSP-Server), create
+	# Diskless Workstation chroot from scratch as clean environment.
+	if echo "$PROFILE" | grep -Eq 'Main-Server' && \
+		echo "$PROFILE" | grep -Eq 'LTSP-Server'; then
+			if [ ! -d /srv/ltsp/dlw ]; then
+				/usr/sbin/debian-edu-ltsp-install --dlw yes
+			fi
+	# else if this runs on a pure LTSP-Server (no Main-Server role), then
+	# let's use the file system of the LTSP-Server and generate the LTSP
+	# image directly from it (faster!).
+	elif echo "$PROFILE" | grep -Eqv 'Main-Server' && \
+		echo "$PROFILE" | grep -Eq  'LTSP-Server'; then
+			if [ ! -f /srv/ltsp/images/$ltspimg ] ; then
+					/usr/sbin/debian-edu-ltsp-install --diskless_workstation yes
+			fi
+	fi
 fi
 
 # Update PXE setup on LTSP servers with proxy values set in environment
@@ -100,10 +122,11 @@ fi
 # Send mail to the first user to avoid the Dovecot permission pitfall
 # also in this special case. It doesn't seem to work during installation,
 # because Exim4 needs to grab information from LDAP which fails at that time.
-FIRSTUSER=$(grep -1 first-user-name /var/cache/debconf/config.dat | grep Value | cut -d' ' -f2)
+if echo "$PROFILE" | grep -q Main-Server ; then
+	FIRSTUSER=$(grep -1 first-user-name /var/cache/debconf/config.dat | grep Value | cut -d' ' -f2)
 
-if [ ! -d /var/mail/"$FIRSTUSER" ] ; then
-    cat << EOF | /usr/lib/sendmail $FIRSTUSER
+	if [ ! -d /var/mail/"$FIRSTUSER" ] ; then
+	    cat << EOF | /usr/lib/sendmail $FIRSTUSER
 Subject: Welcome to the mail-system
 
 Hello $FIRSTUSER,
@@ -113,7 +136,8 @@ welcome to the mail-system.
 (Sent from the Debian Edu first boot script.)
 
 EOF
-	logger -t exim-create-environment -p notice Sent mail to first-user.
+		logger -t exim-create-environment -p notice Sent mail to first-user.
+	fi
 fi
 
 # Create first user's Samba account. The smbpasswd command fails inside d-i



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/bea9780d561028a39e1f219d83dea777e8443600...e1bef19fc3cb597b14a47ae495d9b9fe0c72a8ef

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/bea9780d561028a39e1f219d83dea777e8443600...e1bef19fc3cb597b14a47ae495d9b9fe0c72a8ef
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/20260904/4341ad7c/attachment-0001.htm>


More information about the debian-edu-commits mailing list