加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rear-bz1685166.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-08-21 13:46 . import rear-2.4-7.el7.src.rpm
diff --git a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
index 6b3194bd..57e8777a 100644
--- a/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
+++ b/usr/share/rear/rescue/GNU/Linux/310_network_devices.sh
@@ -562,7 +562,12 @@ function handle_team () {
local network_interface=$1
local sysfspath=/sys/class/net/$network_interface
- if [ "$( ethtool -i $network_interface | awk '$1 == "driver:" { print $2 }' )" != "team" ] ; then
+ if has_binary ethtool ; then
+ if [ "$( ethtool -i $network_interface | awk '$1 == "driver:" { print $2 }' )" != "team" ] ; then
+ return $rc_error
+ fi
+ else
+ LogPrintError "Couldn't determine if network interface '$network_interface' is a Team, skipping."
return $rc_error
fi
@@ -854,10 +859,17 @@ function handle_physdev () {
DebugPrint "$network_interface is a physical device"
- if [ -e $sysfspath/bonding_slave/perm_hwaddr ] ; then
- mac="$( cat $sysfspath/bonding_slave/perm_hwaddr )"
- else
- mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ local mac=""
+
+ if has_binary ethtool ; then
+ mac="$( ethtool -P $network_interface 2>/dev/null | awk '{ print $NF }' )"
+ fi
+ if [ -z "$mac" ] ; then
+ if [ -e $sysfspath/bonding_slave/perm_hwaddr ] ; then
+ mac="$( cat $sysfspath/bonding_slave/perm_hwaddr )"
+ else
+ mac="$( cat $sysfspath/address )" || BugError "Could not read a MAC address for '$network_interface'."
+ fi
fi
# Skip fake interfaces without MAC address
[ "$mac" != "00:00:00:00:00:00" ] || return $rc_error
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化