summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-02-01 15:03:40 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-02-01 15:07:34 -1000
commit8618ff6046247b09cb913cfc3c31d609d8e6f3b0 (patch)
treecf94d3b9dc45959285441e95e5c32f4461db9ceb
parent9a21b859e2d739b56a1c1d75b7dfca0a89513e7e (diff)
downloadanaconda-8618ff6046247b09cb913cfc3c31d609d8e6f3b0.tar.gz
anaconda-8618ff6046247b09cb913cfc3c31d609d8e6f3b0.tar.xz
anaconda-8618ff6046247b09cb913cfc3c31d609d8e6f3b0.zip
Propagate hostname from stage 1 to stage 2 on s390x (#354021).
The hostname and DNS settings on s390x are provided by a kickstart file or by a CMS conf file or by prompting the user in stage 1. Either way, we already have all of that information before we move on to stage 2. The network device post configuration screen in stage 2 was missing the hostname. This patch fixes that as well as fixes some misbehavior with reading those settings from /tmp/netinfo in loader.
-rw-r--r--loader2/linuxrc.s39013
-rw-r--r--loader2/loader.c19
2 files changed, 22 insertions, 10 deletions
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index 539b4e2fa..c820b2549 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -486,15 +486,15 @@ if [ -n "$SEARCHDNS" ]; then
for i in "$SEARCHDNS"; do echo "search $i"; done >> /etc/resolv.conf
fi
if [ -n "$DNS" ]; then
- DNS=`echo $DNS |sed -e 's/:/ /g'`
- for i in $DNS; do echo "nameserver $i"; done >> /etc/resolv.conf
+ RESOLVDNS=`echo $DNS |sed -e 's/:/ /g'`
+ for i in $RESOLVDNS; do echo "nameserver $i"; done >> /etc/resolv.conf
fi
# make sure we have an /etc/hosts file (required for telnetd)
-echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
-echo "::1 localhost6.localdomain6 localhost6" >> /etc/hosts
+echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts
+echo -e "::1\t\tlocalhost6.localdomain6 localhost6" >> /etc/hosts
if [ ! -z "$HOSTNAME" -a ! -z "$IPADDR" ]; then
- echo "$IPADDR $HOSTNAME `echo $HOSTNAME | cut -d '.' -f 1`" >> /etc/hosts
+ echo -e "$IPADDR\t$HOSTNAME `echo $HOSTNAME | cut -d '.' -f 1`" >> /etc/hosts
fi
if [ -z "$DASD" ]; then
@@ -534,7 +534,7 @@ MTU="$MTU"
NETWORK="$NETWORK"
NETMASK="$NETMASK"
BROADCAST="$BROADCAST"
-DNS="$DNS"
+DNS="`echo $DNS | cut -d ':' -f 1`"
SEARCHDNS="$SEARCHDNS"
PEERID="$PEERID"
SUBCHANNELS="$SUBCHANNELS"
@@ -560,6 +560,7 @@ HOSTNAME=$HOSTNAME
MTU=$MTU
SUBCHANNELS=$SUBCHANNELS
EOF
+[ "$DNS" != "" ] && echo "DNS=`echo $DNS | cut -d ':' -f 1`" >> /tmp/netinfo
[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> /tmp/netinfo
[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> /tmp/netinfo
[ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> /tmp/netinfo
diff --git a/loader2/loader.c b/loader2/loader.c
index 9bc2e99e6..6edc64c7f 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -442,6 +442,7 @@ static void readNetInfo(struct loaderData_s ** ld) {
loaderData->netmask = NULL;
loaderData->gateway = NULL;
loaderData->dns = NULL;
+ loaderData->hostname = NULL;
loaderData->peerid = NULL;
loaderData->subchannels = NULL;
loaderData->portname = NULL;
@@ -511,13 +512,14 @@ static void readNetInfo(struct loaderData_s ** ld) {
if (!strncmp(vname, "MACADDR", 7))
loaderData->macaddr = strdup(vparm);
+
+ if (!strncmp(vname, "HOSTNAME", 8))
+ loaderData->hostname = strdup(vparm);
}
}
- if (loaderData->ip && loaderData->netmask) {
- loaderData->ipinfo_set = 1;
+ if (loaderData->ip && loaderData->netmask)
flags |= LOADER_FLAGS_HAVE_CMSCONF;
- }
fclose(f);
}
@@ -1130,7 +1132,10 @@ static char *doLoaderMain(char * location,
if (loaderData->ksFile)
flags |= LOADER_FLAGS_IS_KICKSTART;
- if (!FL_HAVE_CMSCONF(flags)) {
+ if (FL_HAVE_CMSCONF(flags)) {
+ loaderData->ipinfo_set = 1;
+ loaderData->ipv6info_set = 1;
+ } else {
loaderData->ipinfo_set = 0;
loaderData->ipv6info_set = 0;
}
@@ -1171,6 +1176,12 @@ static char *doLoaderMain(char * location,
else
loaderData->ipv6info_set = 1;
+ /* s390 provides all config info by way of the CMS conf file */
+ if (FL_HAVE_CMSCONF(flags)) {
+ loaderData->ipinfo_set = 1;
+ loaderData->ipv6info_set = 1;
+ }
+
/* populate netDev based on any kickstart data */
if (loaderData->ipinfo_set) {
netDev.preset = 1;