aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarm Berntsen <harm.berntsen@nedap.com>2019-04-27 15:24:45 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-06-07 17:06:22 +0000
commit747dd89a1c1dd388d46fe667b1bf754d59c3738b (patch)
treea3d04931a7a9e638539ffd34c242cd9478e1a8ad
parent29cb8111788f0c11ba90757ca477bc76a824f2ac (diff)
downloadmkinitfs-747dd89a1c1dd388d46fe667b1bf754d59c3738b.tar.bz2
mkinitfs-747dd89a1c1dd388d46fe667b1bf754d59c3738b.tar.xz
Add missing return to ip_choose_if
Right now, when $KOPT_BOOTIF is specified, it can echo a device related to that option and still continue with the loop that checks the operstate. Due to this, it can echo two network interfaces. This commit fixes that so it will only return a single network interface.
-rwxr-xr-xinitramfs-init.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/initramfs-init.in b/initramfs-init.in
index 4760714..4f96b7c 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -128,7 +128,7 @@ ip_choose_if() {
mac=$(printf "%s\n" "$KOPT_BOOTIF"|sed 's/^01-//;s/-/:/g')
dev=$(grep -l $mac /sys/class/net/*/address|head -n 1)
dev=${dev%/*}
- [ -n "$dev" ] && echo "${dev##*/}"
+ [ -n "$dev" ] && echo "${dev##*/}" && return
fi
for x in /sys/class/net/eth*; do
if grep -iq up $x/operstate;then