From 532b1906b0644d836cb5f54f32a888ada35a89fb Mon Sep 17 00:00:00 2001 From: QiLiang Date: Thu, 16 Mar 2017 10:07:45 +0800 Subject: Fix preseed MAC address fetch method JIRA: - e.g.: root@host1:~# ip link show eth4 6: eth4: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether ec:38:8f:79:fa:5c brd ff:ff:ff:ff:ff:ff root@host1:~# echo $(echo $@ | cut -d' ' -f17) ec:38:8f:79:fa:5c root@host4:~# ip link show eth4 6: eth4: mtu 1500 qdisc noop portid 0100000000000000000000000000003000 state DOWN mode DEFAULT group default qlen 1000 link/ether e0:36:76:d2:34:73 brd ff:ff:ff:ff:ff:ff root@host4:~# echo $(echo $@ | cut -d' ' -f17) 1000 root@host4:~# echo $(echo $@ | cut -d' ' -f19) e0:36:76:d2:34:73 Change-Id: I916c19807da724e9ba471376f81f3c763b9340d5 Signed-off-by: QiLiang --- .../cobbler/snippets/preseed_post_install_network_config | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'deploy/adapters') diff --git a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config index cb79c556..a2abbf71 100644 --- a/deploy/adapters/cobbler/snippets/preseed_post_install_network_config +++ b/deploy/adapters/cobbler/snippets/preseed_post_install_network_config @@ -50,14 +50,7 @@ echo "physical interfaces: \${physical_interfaces}" >> /tmp/network_log # map physical interface to mac address mac_names="" for physical_interface in \${physical_interfaces}; do - set \$(ip link show \${physical_interface}) -#if $osversion == "trusty" - mac=\$(echo \$@ | cut -d' ' -f17) -#elif $osversion == "xenial" - mac=\$(echo \$@ | cut -d' ' -f17) -#else - mac=\$(echo \$@ | cut -d' ' -f13) -#end if + mac=\$(ip link show \${physical_interface} | awk 'match(\$0,/link\/ether/) {print \$2}') mac_name=\$(echo \${mac} |tr 'a-z' 'A-Z' | tr ':' '_') if [ -z "\${mac_name}" ]; then mac_names="\${mac_name}" -- cgit 1.2.3-korg