On 10/17/2012 03:50 PM, Nishanth Aravamudan wrote:
On 15.10.2012 [11:22:27 -0600], Orion Poplawski wrote:
> Fedora 18 doesn't have ifconfig in the installer (and perhaps not in
> installed system), need to use ip.
Did you ensure this works as expected on older Fedora too? Is it better
to use ifconfig when present (as it's tested) and switch to ip only when
ifconfig isn't there?
I have not tested on older Fedora, but you're using ip already to set the
route, so it is present. And ip on RHEL5 has the -o option, so I think
shifting to ip is the way to go. It's easier to parse.
>
> --
> Orion Poplawski
> Technical Manager 303-415-9701 x222
> NWRA, Boulder Office FAX: 303-415-9702
> 3380 Mitchell Lane orion(a)nwra.com
> Boulder, CO 80301
http://www.nwra.com
> From a5fb8831b0370cc363d8b293c67935901ac85062 Mon Sep 17 00:00:00 2001
> From: Orion Poplawski <orion(a)nwra.com>
> Date: Mon, 15 Oct 2012 11:14:54 -0600
> Subject: [PATCH] Up ip instead of ifconfig
>
> ---
> snippets/post_install_network_config | 2 +-
> snippets/pre_install_network_config | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/snippets/post_install_network_config
b/snippets/post_install_network_config
> index 6821c6f..4acd4b8 100644
> --- a/snippets/post_install_network_config
> +++ b/snippets/post_install_network_config
> @@ -138,7 +138,7 @@ echo "ONBOOT=yes" >> $devfile
> #if $mac != "" and $iface_type not in
("master","bond","bridge")
> ## virtual interfaces don't get MACs
> echo "HWADDR=$mac" >> $devfile
> -IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1)
> +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 8bb3495..10c5405 100644
> --- a/snippets/pre_install_network_config
> +++ b/snippets/pre_install_network_config
> @@ -76,9 +76,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)
> + 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(a)lists.fedorahosted.org
>
https://lists.fedorahosted.org/mailman/listinfo/cobbler
--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA, Boulder Office FAX: 303-415-9702
3380 Mitchell Lane orion(a)nwra.com
Boulder, CO 80301
http://www.nwra.com