On 10/19/2012 07:41 PM, James Cammarata wrote:
On Wed, Oct 17, 2012 at 6:13 PM, Orion Poplawski <[email protected]> wrote:


How is this?

Still no good unfortunately (ignore the trailing whitespace errors):

# git apply 0001-Use-ip-instead-of-ifconfig.patch
0001-Use-ip-instead-of-ifconfig.patch:23: trailing whitespace.
IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
0001-Use-ip-instead-of-ifconfig.patch:36: trailing whitespace.
if ip link | grep -i $mac
0001-Use-ip-instead-of-ifconfig.patch:42: trailing whitespace.
   IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
error: patch failed: snippets/post_install_network_config:142
error: snippets/post_install_network_config: patch does not apply
error: patch failed: snippets/pre_install_network_config:86
error: snippets/pre_install_network_config: patch does not apply


I don't know what to say. It applies fine for me to a freshly cloned git repo from git://github.com/cobbler/cobbler

--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder Office                  FAX: 303-415-9702
3380 Mitchell Lane                       [email protected]
Boulder, CO 80301                   http://www.nwra.com
>From 9c69c279a23e2448689b529a7cc40c5093719f78 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <[email protected]>
Date: Tue, 30 Oct 2012 10:30:31 -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
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/cobbler

Reply via email to