Skip to contentSkip to conversation

add anaconda-style option parsing to ip_to_var

PATCH In review Will Woods 2 participants 2 messages May 22, 2012 – May 29, 2012 1 message not in the archive

lore
Share & tools
lore

Will Woods

author
#0 lore raw

PATCH 1/1 add anaconda-style option parsing to ip_to_var

Anaconda used arguments of the form:

ip=<ip> gateway=<gw> netmask=<nm>

for static IP configuration. So if we get a value for "ip" that's an IP address, look for gateway= and netmask= and related args to fill in the ip config vars.

---
 modules.d/40network/net-lib.sh |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
modules.d/40network/net-lib.sh +14 -0
index d6adda9..75ad5e3 100644
@@ -266,4 +266,18 @@ ip_to_var() {
         4)  dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
         *)  ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
     esac
+    # anaconda-style argument cluster
+    if strstr "$autoconf" "*.*.*.*"; then
+        ip="$autoconf"
+        gw=$(getarg gateway=)
+        mask=$(getarg netmask=)
+        hostname=$(getarg hostname=)
+        dev=$(getarg ksdevice=)
+        autoconf="none"
+        mtu=$(getarg mtu=)
+        case "$dev" in
+            # ignore fancy values for ksdevice=XXX
+            link|bootif|BOOTIF|ibft|*:*:*:*:*:*) dev="" ;;
+        esac
+    fi
 }
Signature · 1 line
1.7.10.1
#2 lore raw
In reply to a message not in the archive

Am 23.05.2012 00:31, schrieb Will Woods:

Quoted 24 lines

Anaconda used arguments of the form:

ip=<ip> gateway=<gw> netmask=<nm>

for static IP configuration. So if we get a value for "ip" that's an IP address, look for gateway= and netmask= and related args to fill in the ip config vars.

---
 modules.d/40network/net-lib.sh |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
modules.d/40network/net-lib.sh +5 -0
index d6adda9..75ad5e3 100644
@@ -266,4 +266,18 @@ ip_to_var() {
         4)  dev=$1; autoconf=$2; mtu=$3; macaddr=$4 ;;
         *)  ip=$1; srv=$2; gw=$3; mask=$4; hostname=$5; dev=$6; autoconf=$7; mtu=$8; macaddr=$9 ;;
     esac
+    # anaconda-style argument cluster
+    if strstr "$autoconf" "*.*.*.*"; then
+        ip="$autoconf"
+        gw=$(getarg gateway=)
+        mask=$(getarg netmask=)

modules.d/40network/net-lib.sh ip_to_var() { · line 283

Quoted 10 lines
modules.d/40network/net-lib.sh +9 -0
+        hostname=$(getarg hostname=)
+        dev=$(getarg ksdevice=)
+        autoconf="none"
+        mtu=$(getarg mtu=)
+        case "$dev" in
+            # ignore fancy values for ksdevice=XXX
+            link|bootif|BOOTIF|ibft|*:*:*:*:*:*) dev="" ;;
+        esac
+    fi
 }

pushed