|
|
1070a0 |
--- a/snippets/post_install_network_config
|
|
|
1070a0 |
+++ a/snippets/post_install_network_config
|
|
|
1070a0 |
@@ -147,7 +147,7 @@ fi
|
|
|
1070a0 |
#if $configbymac and $is_vlan == "false" and $bonding.lower() != "master"
|
|
|
1070a0 |
## This is the code path physical interfaces will follow.
|
|
|
1070a0 |
## Get the current interface name
|
|
|
1070a0 |
-IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d ' ' -f 1)
|
|
|
1070a0 |
+IFNAME=\$(ip -o link | grep -i '$mac' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
|
|
|
1070a0 |
## Rename this interface in modprobe.conf
|
|
|
1070a0 |
## FIXME: if both interfaces startwith eth this is wrong
|
|
|
1070a0 |
if [ -f "/etc/modprobe.conf" ] && [ \$IFNAME ]; then
|
|
|
1070a0 |
--- a/snippets/pre_install_network_config
|
|
|
1070a0 |
+++ a/snippets/pre_install_network_config
|
|
|
1070a0 |
@@ -1,5 +1,27 @@
|
|
|
1070a0 |
#if $getVar("system_name","") != ""
|
|
|
1070a0 |
# Start pre_install_network_config generated code
|
|
|
1070a0 |
+#raw
|
|
|
1070a0 |
+# generic functions to be used later for discovering NICs
|
|
|
1070a0 |
+mac_exists() {
|
|
|
1070a0 |
+ if which ip &> /dev/null; then
|
|
|
1070a0 |
+ ip -o link | grep -i "$1" &> /dev/null
|
|
|
1070a0 |
+ return $?
|
|
|
1070a0 |
+ else
|
|
|
1070a0 |
+ ifconfig -a | grep -i "$1" &> /dev/null
|
|
|
1070a0 |
+ return $?
|
|
|
1070a0 |
+ fi
|
|
|
1070a0 |
+}
|
|
|
1070a0 |
+get_ifname() {
|
|
|
1070a0 |
+ if which ip &> /dev/null; then
|
|
|
1070a0 |
+ IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
|
|
|
1070a0 |
+ else
|
|
|
1070a0 |
+ IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
|
|
|
1070a0 |
+ if [ -z $IFNAME ]; then
|
|
|
1070a0 |
+ IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
|
|
|
1070a0 |
+ fi
|
|
|
1070a0 |
+ fi
|
|
|
1070a0 |
+}
|
|
|
1070a0 |
+#end raw
|
|
|
1070a0 |
#set ikeys = $interfaces.keys()
|
|
|
1070a0 |
#import re
|
|
|
1070a0 |
#set $vlanpattern = $re.compile("[a-zA-Z0-9]+[\.:][0-9]+")
|
|
|
1070a0 |
@@ -75,9 +97,9 @@
|
|
|
1070a0 |
#set $netinfo = "%s --hostname=%s" % ($netinfo, $hostname)
|
|
|
1070a0 |
#end if
|
|
|
1070a0 |
# Configuring $iname ($mac)
|
|
|
1070a0 |
-if ifconfig -a | grep -i $mac
|
|
|
1070a0 |
+if mac_exists $mac
|
|
|
1070a0 |
then
|
|
|
1070a0 |
- IFNAME=\$(ifconfig -a | grep -i '$mac' | cut -d " " -f 1)
|
|
|
1070a0 |
+ get_ifname $mac
|
|
|
1070a0 |
echo "network --device=\$IFNAME $netinfo" >> /tmp/pre_install_network_config
|
|
|
1070a0 |
fi
|
|
|
1070a0 |
#else
|
|
|
1070a0 |
|