[Git][debian-edu/debian-edu-config][master] 3 commits: share/debian-edu-config/d-i/pre-pkgsel: Support hostname override via...

"Mike Gabriel (@sunweaver)" <[email protected]>
Newsgroups gmane.linux.skolelinux.cvs
Message-ID <[email protected]>

Mike Gabriel pushed to branch master at Debian Edu / debian-edu-config


Commits:
8b60974e by Mike Gabriel at 2026-08-25T19:07:48+00:00
share/debian-edu-config/d-i/pre-pkgsel: Support hostname override via /proc/cmdline. (Closes: #1008597).

- - - - -
22bbc38a by Daniel Teichmann at 2026-08-25T19:07:48+00:00
share/debian-edu-config/d-i/pre-pkgsel: Tighten hostname= parsing and sanitization from /proc/cmdline.

Handle hostname= as first cmdline token, ignore empty values and
strip characters invalid in hostnames.

- - - - -
107e8bf0 by Daniel Teichmann at 2026-08-25T19:07:48+00:00
share/debian-edu-config/d-i/pre-pkgsel: strip hyphens only when present

Use 's/^-+//' / 's/-+$//' instead of '-*' so the substitution only
fires when there actually is a leading/trailing hyphen to remove.

- - - - -


1 changed file:

- share/debian-edu-config/d-i/pre-pkgsel


Changes:

=====================================
share/debian-edu-config/d-i/pre-pkgsel
=====================================
@@ -179,6 +179,19 @@ EOF
         echo "ff02::3         ip6-allhosts"
     ) > /target/etc/hosts
 
+    # Check whether hostname= was given on boot's /proc/cmdline prompt
+    # and use that if not installing a Main-Server.
+    PROC_CMDLINE_HOSTNAME=$(cat /proc/cmdline |
+        sed -n -re "s/.*(^| )hostname=([^ ]+).*/\2/p" |
+        tr A-Z a-z |
+        tr -cd 'a-z0-9-' |
+        sed -e 's/^-+//' -e 's/-+$//')
+    if echo $PROFILE | grep -q Main-Server ; then
+        :
+    elif [ -n "${PROC_CMDLINE_HOSTNAME}" ]; then
+        MY_HOSTNAME="${PROC_CMDLINE_HOSTNAME}"
+    fi
+
     if [ ! -z "$MY_HOSTNAME" ] ; then
         echo "$MY_HOSTNAME" > /target/etc/hostname
         in-target /bin/hostname "$MY_HOSTNAME"
@@ -188,7 +201,7 @@ EOF
     # generate from MAC address, unless installing main-server.
     if echo $PROFILE | grep -q Main-Server ; then
         :
-    elif [ -x /target/usr/sbin/update-hostname-from-ip ] ; then
+    elif [ -x /target/usr/sbin/update-hostname-from-ip ] && [ -z "${PROC_CMDLINE_HOSTNAME}" ]; then
         in-target /usr/sbin/update-hostname-from-ip -m || true
     fi
 



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/c24d32a249eb8ebc1078a15a37d4176093c24a84...107e8bf0bb603ee7e4f0730a33db08ffe8134ec0

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/c24d32a249eb8ebc1078a15a37d4176093c24a84...107e8bf0bb603ee7e4f0730a33db08ffe8134ec0
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

_______________________________________________
debian-edu-commits mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-edu-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.