|
Harald Hoyer |
83ebbb |
From da55af4763d6a88da5a0b31cb68cdc0a2adfcd7e Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
83ebbb |
From: Ian Dall <ian@beware.dropbear.id.au>
|
|
Harald Hoyer |
83ebbb |
Date: Mon, 23 Jan 2012 10:46:10 +0100
|
|
Harald Hoyer |
83ebbb |
Subject: [PATCH] network/dhclient-script: set FQDN
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
When booting with nfsroot, dracut doesn't necessarily set the initial
|
|
Harald Hoyer |
83ebbb |
hostname correctly.
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
According to dhcp-options(5), the name may or may not be qualified with
|
|
Harald Hoyer |
83ebbb |
the local domain. It goes on to say "it is preferable to use the
|
|
Harald Hoyer |
83ebbb |
domain-name option to specify the domain name".
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
So dhclient-script needs to be able to handle the cases: a) where
|
|
Harald Hoyer |
83ebbb |
host-name is fully qualified and domain name is also specified; b)
|
|
Harald Hoyer |
83ebbb |
where hostname is fully qualified and the domain is not separately
|
|
Harald Hoyer |
83ebbb |
specified; c) where host-name is "short" and domain-name is also
|
|
Harald Hoyer |
83ebbb |
specified; and d) do its best where host-name is short but domain-name
|
|
Harald Hoyer |
83ebbb |
is not specified.
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
The dhclient-script in initramfs does not handle case "c", apparently
|
|
Harald Hoyer |
83ebbb |
the preferred situation properly, setting hostname to "short".
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
https://bugzilla.redhat.com/show_bug.cgi?id=756347
|
|
Harald Hoyer |
83ebbb |
---
|
|
Harald Hoyer |
83ebbb |
modules.d/40network/dhclient-script | 4 +++-
|
|
Harald Hoyer |
83ebbb |
1 files changed, 3 insertions(+), 1 deletions(-)
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
diff --git a/modules.d/40network/dhclient-script b/modules.d/40network/dhclient-script
|
|
Harald Hoyer |
83ebbb |
index 2c26838..e8bd8b2 100755
|
|
Harald Hoyer |
83ebbb |
--- a/modules.d/40network/dhclient-script
|
|
Harald Hoyer |
83ebbb |
+++ b/modules.d/40network/dhclient-script
|
|
Harald Hoyer |
83ebbb |
@@ -41,7 +41,9 @@ setup_interface() {
|
|
Harald Hoyer |
83ebbb |
done
|
|
Harald Hoyer |
83ebbb |
fi >> /tmp/net.$netif.resolv.conf
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
- [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
|
Harald Hoyer |
83ebbb |
+ # Note: hostname can be fqdn OR short hostname, so chop off any
|
|
Harald Hoyer |
83ebbb |
+ # trailing domain name and explicity add any domain if set.
|
|
Harald Hoyer |
83ebbb |
+ [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
|
Harald Hoyer |
83ebbb |
}
|
|
Harald Hoyer |
83ebbb |
|
|
Harald Hoyer |
83ebbb |
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|