Skip to content

Commit 6e60043

Browse files
committed
functions: fix
Signed-off-by: AuxXxilium <[email protected]>
1 parent 71544e3 commit 6e60043

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

files/initrd/opt/arc/include/functions.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ function getBus() {
357357
function getIP() {
358358
local IP=""
359359
if [ -n "${1}" ] && [ -d "/sys/class/net/${1}" ]; then
360-
IP=$(ip route show dev "${1}" 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1)
361-
[ -z "${IP}" ] && IP=$(ip addr show "${1}" scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1)
360+
IP=$(ip addr show "${1}" scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1)
361+
[ -z "${IP}" ] && IP=$(ip route show dev "${1}" 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1)
362362
else
363-
IP=$(ip route show 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1 | awk '{$1=$1};1')
364-
[ -z "${IP}" ] && IP=$(ip addr show scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1)
363+
IP=$(ip addr show scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1)
364+
[ -z "${IP}" ] && IP=$(ip route show 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1)
365365
fi
366366
echo "${IP}"
367367
return 0

0 commit comments

Comments
 (0)