summaryrefslogtreecommitdiffstats
path: root/imgcreate/kickstart.py
diff options
context:
space:
mode:
authorBrian C. Lane <bcl@redhat.com>2012-12-04 18:52:19 (GMT)
committerBrian C. Lane <bcl@redhat.com>2012-12-04 18:52:19 (GMT)
commit2f58f519a2693d4eecac9adb968061c503c18ab1 (patch)
tree27bd818f2604b3ea1a2f02b7c0159b3c50221962 /imgcreate/kickstart.py
parent84b14777b7d9025a802e03008fcec670d4164f1f (diff)
downloadlivecd-2f58f519a2693d4eecac9adb968061c503c18ab1.zip
livecd-2f58f519a2693d4eecac9adb968061c503c18ab1.tar.gz
livecd-2f58f519a2693d4eecac9adb968061c503c18ab1.tar.xz
write hostname to /etc/hostname (#870805)
Diffstat (limited to 'imgcreate/kickstart.py')
-rw-r--r--imgcreate/kickstart.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 7adb37a..7ee4102 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -328,11 +328,6 @@ class NetworkConfig(KickstartConfig):
else:
f.write("NETWORKING_IPV6=no\n")
- if hostname:
- f.write("HOSTNAME=%s\n" % hostname)
- else:
- f.write("HOSTNAME=localhost.localdomain\n")
-
if gateway:
f.write("GATEWAY=%s\n" % gateway)
@@ -354,6 +349,16 @@ class NetworkConfig(KickstartConfig):
f.write("::1\t\tlocalhost6.localdomain6 localhost6\n")
f.close()
+ def write_hostname(self, hostname):
+ if not hostname:
+ return
+
+ path = self.path("/etc/hostname")
+ f = file(path, "w+")
+ os.chmod(path, 0644)
+ f.write("%s\n" % (hostname,))
+ f.close()
+
def write_resolv(self, nodns, nameservers):
if nodns or not nameservers:
return
@@ -407,6 +412,7 @@ class NetworkConfig(KickstartConfig):
self.write_sysconfig(useipv6, hostname, gateway)
self.write_hosts(hostname)
+ self.write_hostname(hostname)
self.write_resolv(nodns, nameservers)
class SelinuxConfig(KickstartConfig):