Adding support for variables (ip and mac addresses) in hostname script.
authorDaniel Baumann <daniel@debian.org>
Fri, 4 Jan 2013 22:46:13 +0000 (23:46 +0100)
committerDaniel Baumann <daniel@debian.org>
Fri, 4 Jan 2013 22:47:00 +0000 (23:47 +0100)
scripts/config/0020-hostname

index 3872437..21c3e84 100755 (executable)
 
 Hostname ()
 {
+       # Supporting variables within hostnames
+       LINK="$(ip -oneline -family link address show dev eth0 | awk '{ print $13 }' | sed -e 's|:|-|g')"
+       INET="$(ip -oneline -family inet address show dev eth0 | awk '{ print $4 }' | sed -e 's|\.|-|g' -e 's|/.*||')"
+       INET6="$(ip -oneline -family inet6 address show dev eth0 | awk '{ print $4 }' | sed -e 's|:|-|g' -e 's|/.*||' -e 's|--|-|')"
+
        # Reading kernel command line
        for _PARAMETER in ${_CMDLINE}
        do