On 10/17/2012 03:39 PM, James Cammarata wrote:
On Mon, Oct 15, 2012 at 12:22 PM, Orion Poplawski <or...@cora.nwra.com> wrote:
Fedora 18 doesn't have ifconfig in the installer (and perhaps not in
installed system), need to use ip.

What branch did you create this against? It did not apply to master.
Can you rebase this against master and resend it?

How is this?

--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder Office                  FAX: 303-415-9702
3380 Mitchell Lane                       or...@nwra.com
Boulder, CO 80301                   http://www.nwra.com
>From 2bd6f98128a06fe7f38048d579c43e81314c1b64 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <or...@nwra.com>
Date: Wed, 17 Oct 2012 17:12:59 -0600
Subject: [PATCH] Use ip instead of ifconfig

---
 snippets/post_install_network_config | 5 +----
 snippets/pre_install_network_config  | 7 ++-----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/snippets/post_install_network_config b/snippets/post_install_network_config
index d21d6e2..363f4f2 100644
--- a/snippets/post_install_network_config
+++ b/snippets/post_install_network_config
@@ -142,10 +142,7 @@ echo "ONBOOT=yes" >> $devfile
             #if $mac != "" and $iface_type not in ("master","bond","bridge","bonded_bridge_slave")
             ## virtual interfaces don't get MACs
 echo "HWADDR=$mac" >> $devfile
-IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1)
-if [ -z \$IFNAME ]; then
-    IFNAME=\$(ifconfig -a | grep -i -B 2 '$mac' | sed -n '/flags/s/:.*$//p')
-fi
+IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
             ## Rename this interface in modprobe.conf
             ## FIXME: if both interfaces startwith eth this is wrong
 if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then
diff --git a/snippets/pre_install_network_config b/snippets/pre_install_network_config
index 5425f54..b158069 100644
--- a/snippets/pre_install_network_config
+++ b/snippets/pre_install_network_config
@@ -86,12 +86,9 @@
                 #set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname)
             #end if
 # Configuring $iname ($mac)
-if ifconfig -a | grep -i $mac
+if ip link | grep -i $mac
 then
-  IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1)
-  if [ -z \$IFNAME ]; then
-    IFNAME=\$(ifconfig -a | grep -i -B 2 '$mac' | sed -n '/flags/s/:.*$//p')
-  fi
+  IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
   echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config
             #for $route in $static_routes
                 #if $routepattern.match($route)
-- 
1.7.11.7

_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler

Reply via email to