-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ack and applied. On Wed, 2 Jun 2010, Steffen Maier wrote:
Pass configured network device on s390 to loader via /tmp/s390net rather than the DEVICE environment variable. Using the environment variable only works when loader is the child process of /sbin/init, which only happens with RUNKS=1. Other installs on s390 invoke loader as the ssh login shell, so they never see the DEVICE environment variable. --- booty/bootloaderInfo.py | 15 --------------- loader/linuxrc.s390 | 45 +++++++-------------------------------------- loader/loader.c | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 59 deletions(-) diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py index d019edf..a0a7b4d 100644 --- a/booty/bootloaderInfo.py +++ b/booty/bootloaderInfo.py @@ -172,26 +172,11 @@ class KernelArguments: def __init__(self, anaconda): newArgs = [] - cfgFilename = "/tmp/install.cfg" self.anaconda = anaconda if iutil.isS390(): self.cargs = [] - f = open(cfgFilename) - for line in f: - try: - (vname,vparm) = line.split('=', 1) - vname = vname.strip() - vparm = vparm.replace('"','') - vparm = vparm.strip() - if vname == "CHANDEV": - self.cargs.append(vparm) - if vname == "QETHPARM": - self.cargs.append(vparm) - except Exception, e: - pass - f.close() # look for kernel arguments we know should be preserved and add them ourargs = ["speakup_synth", "apic", "noapic", "apm", "ide", "noht", diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 614f7ff..356426e 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2973,49 +2973,18 @@ done # [ "$ipv6" ] && echo "IPV6=yes" # transfer options into install environment -cat > /tmp/install.cfg << EOF -LANG="$LANG" -S390ARCH="$S390ARCH" -TEXTDOMAIN="$TEXTDOMAIN" -TEXTDOMAINDIR="$TEXTDOMAINDIR" -PORTNAME="$PORTNAME" -HOSTNAME="$HOSTNAME" -DEVICE="$DEVICE" -NETTYPE="$NETTYPE" -IPADDR="$IPADDR" -GATEWAY="$GATEWAY" -MTU="$MTU" -NETWORK="$NETWORK" -NETMASK="$NETMASK" -BROADCAST="$BROADCAST" -SEARCHDNS="$SEARCHDNS" -PEERID="$PEERID" -SUBCHANNELS="$SUBCHANNELS" -ONBOOT="yes" -CTCPROT="$CTCPROT" -EOF +# loader now uses ifcfg instead of install.cfg to receive our network config + +# additionally, loader's readNetInfo needs to know our DEVICE name +echo $DEVICE > /tmp/s390net + if [ "$ipv6" ]; then DNS1=$(echo $DNS | cut -d ',' -f 1) - echo DNS=\"$DNS1\" >> /tmp/install.cfg - echo DNS1=\"$DNS1\" >> /tmp/install.cfg - echo DNS2=\"$(echo $DNS | cut -d ',' -f 2)\" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ',' -f 2) else DNS1=$(echo $DNS | cut -d ':' -f 1) - echo DNS=\"$DNS1\" >> /tmp/install.cfg - echo DNS1=\"$DNS1\" >> /tmp/install.cfg - echo DNS2=\"$(echo $DNS | cut -d ':' -f 2)\" >> /tmp/install.cfg + DNS2=$(echo $DNS | cut -d ':' -f 2) fi -cat >> /tmp/install.cfg << EOF -export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR -export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU -export NETWORK NETMASK BROADCAST DNS DNS1 DNS2 SEARCHDNS -export PEERID ONBOOT SUBCHANNELS CTCPROT -EOF -# immediately read it in again to export these into the shell below -. /tmp/install.cfg -if [ -z "$testing" ]; then - cat /tmp/install.cfg >> /etc/profile -fi # testing NETSCRIPTS="/etc/sysconfig/network-scripts" IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" diff --git a/loader/loader.c b/loader/loader.c index 14c7be6..a154ecc 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -633,20 +633,47 @@ static void writeVNCPasswordFile(char *pfile, char *password) { */ static void readNetInfo(struct loaderData_s ** ld) { struct loaderData_s * loaderData = *ld; - char *cfgfile = NULL; - gchar *contents = NULL; + char *cfgfile = NULL, *devfile = "/tmp/s390net"; + gchar *contents = NULL, *device = NULL; gchar **lines = NULL, **line = NULL; GError *e = NULL; - /* when this function is called, the DEVICE environment variable + /* when this function is called, /tmp/s390net * contains the device name whose ifcfg file we want to read */ - if (!getenv("DEVICE")) { + if (!g_file_test(devfile, G_FILE_TEST_EXISTS)) { + logMessage(DEBUGLVL, "readNetInfo %s not found, early return", devfile); + return; + } + if (!g_file_get_contents(devfile, &contents, NULL, &e)) { + logMessage(ERROR, "error reading %s: %s", devfile, e->message); + g_error_free(e); + abort(); + } + line = lines = g_strsplit(contents, "\n", 0); + g_free(contents); + while (*line != NULL) { + gchar *tmp = g_strdup(*line); + tmp = g_strstrip(tmp); + logMessage(DEBUGLVL, "readNetInfo stripped line: %s", tmp); + if (strlen(tmp) > 0) { + device = strdup(tmp); + g_free(tmp); + logMessage(DEBUGLVL, "readNetInfo found device: %s", device); + break; + } + g_free(tmp); + line++; + } + g_strfreev(lines); + if (strlen(device) == 0) { return; + logMessage(DEBUGLVL, "readNetInfo no device found"); } checked_asprintf(&cfgfile, "/etc/sysconfig/network-scripts/ifcfg-%s", - getenv("DEVICE")); + device); + logMessage(INFO, "readNetInfo cfgfile: %s", cfgfile); /* make sure everything is NULL before we begin copying info */ loaderData->ipv4 = NULL; @@ -1495,7 +1522,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData, logMessage(INFO, "going to do getNetConfig"); - /* s390 provides all config info by way of the CMS conf file */ + /* s390 provides all config info by way of linuxrc.s390 */ if (FL_HAVE_CMSCONF(flags)) { loaderData->ipinfo_set = 1; #ifdef ENABLE_IPV6
- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEARECAAYFAkwGufcACgkQ5hsjjIy1Vkkn/ACg22nR/KTHk+iKsx/iCTXWX4T2 IvkAoL9+1YyE8wv/13NkAC8G2FgZpJi7 =qR0i -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list