diff options
author | Jonathan Bauer | 2014-03-11 16:44:15 +0100 |
---|---|---|
committer | Jonathan Bauer | 2014-03-11 16:44:15 +0100 |
commit | 4967f965fd5b9e9160f7cc0f45d2be250b21063c (patch) | |
tree | 7eead28be03ecc1f60a46bd95b3fb8d0792f7e81 /remote/modules/dhcpc-busybox | |
parent | Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts (diff) | |
download | tm-scripts-4967f965fd5b9e9160f7cc0f45d2be250b21063c.tar.gz tm-scripts-4967f965fd5b9e9160f7cc0f45d2be250b21063c.tar.xz tm-scripts-4967f965fd5b9e9160f7cc0f45d2be250b21063c.zip |
[udhcpcdcdcdcd] fix wrong hostname name being set
TODO: rewrite this ugly piece of code
Diffstat (limited to 'remote/modules/dhcpc-busybox')
-rwxr-xr-x | remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index 17932f48..2675afc2 100755 --- a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -106,6 +106,7 @@ case "$1" in # Things that should only happen for the main interface that was used for booting if [ "$interface" == "br0" ]; then dns_host=$(rdns "$ip") + short="${dns_host%%.*}" # Update IP sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config @@ -122,8 +123,8 @@ case "$1" in fi # finally, if dns_host was set to anything, apply it if [ -n "$dns_host" ]; then - echo "$dns_host" > "/proc/sys/kernel/hostname" - echo "$dns_host" > "/etc/hostname" + echo "$short" > "/proc/sys/kernel/hostname" + echo "$short" > "/etc/hostname" if grep '^SLX_HOSTNAME=' /opt/openslx/config 2>/dev/null; then sed -i "s/^\(SLX_HOSTNAME=\).*$/\1'$dns_host'/" /opt/openslx/config else @@ -134,7 +135,7 @@ case "$1" in # if domain is given from dhcp, save it to openslx config for later use in VMs if [ -n "$domain" ]; then - # check if SLX_NET_DOMAIN is in the config at all + # check if SLX_NET_DOMAIN is in the config at all if grep '^SLX_NET_DOMAIN=' /opt/openslx/config 2>/dev/null; then sed -i "s/^\(SLX_NET_DOMAIN=\).*$/\1'$domain'/" /opt/openslx/config else |