[Pkg-ltsp-devel] Bug#483760: ltsp-client: Generate unique hostname when reverse DNS lookup fail

Vagrant Cascadian vagrant at freegeek.org
Wed Jun 11 18:23:34 UTC 2008


On Fri, May 30, 2008 at 11:41:11PM +0200, Petter Reinholdtsen wrote:
> I propose to generate a unique hostname for these hosts based on their
> network MAC address of the client, like "ltsp-00:00:00:00:00:00".  It
> would make it fairly easy to recognize which client was running at a
> given moment in time when no reverse DNS lookup is available.

--- client/initramfs/scripts/nfs-bottom/ltsp    2007-09-14 03:05:14 +0000
+++ client/initramfs/scripts/nfs-bottom/ltsp    2008-05-30 22:16:47 +0000
@@ -4,5 +4,8 @@
 
 read HOSTNAME < /proc/sys/kernel/hostname
 if [ "${HOSTNAME}" = "(none)" ]; then
-    echo "ltsp" > /proc/sys/kernel/hostname
+    INTERFACE="$(/sbin/route -n | awk '/^0\.0\.0\.0 / { print $8 }')"
+    MAC=$(ifconfig $INTERFACE | awk '/HWaddr/ {print $5}')
+    EXTRA_NAME="$(echo $MAC | tr ':' '-')"
+    echo "ltsp$EXTRA_NAME" > /proc/sys/kernel/hostname
 fi

this patch (based on suggestions from pere) would basically work,
although i would like to figure out some way to make it optional.

using an lts.conf option would be ideal from the ltsp perspective,
though a little complicated to implement in the initramfs. might also be
able to hook into initramfs-tools conf.d ...

live well,
  vagrant





More information about the Pkg-ltsp-devel mailing list