commit:     7586670d136162f90a2140ac4af83f1b19fbe09f
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 03:51:32 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 14:13:03 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=7586670d

initrd.scripts: iface_name(): handle /sys/class/net/*/address errors

Fixes 11eff5eb ("Rework --ssh support")
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index c016662..1004ff5 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1848,7 +1848,9 @@ iface_name() {
 
                for interface in /sys/class/net/*
                do
-                       if [ $(cat ${interface}/address) = "${mac}" ]
+                       [ -e ${interface}/address ] || continue
+
+                       if [ "$(cat ${interface}/address 2>/dev/null)" = 
"${mac}" ]
                        then
                                echo ${interface##*/}
                                return

Reply via email to