Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/
Date: Thu, 18 Jul 2019 17:32:25
Message-Id: 1563470718.2210b434bdf7bc04af91582c0e306b480f530560.whissi@gentoo
1 commit: 2210b434bdf7bc04af91582c0e306b480f530560
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 18 17:25:18 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 18 17:25:18 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2210b434
7
8 initrd.scripts: kill_network(): Don't try to kill network when interfacec is missing
9
10 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
11
12 defaults/initrd.scripts | 8 +++++++-
13 1 file changed, 7 insertions(+), 1 deletion(-)
14
15 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
16 index 9e70c00..5e1029c 100644
17 --- a/defaults/initrd.scripts
18 +++ b/defaults/initrd.scripts
19 @@ -1713,6 +1713,12 @@ kill_network() {
20 kill $(cat "${GK_NET_DHCP_PIDFILE}")
21 fi
22
23 + if [ ! -d "/sys/class/net/${GK_NET_IFACE}" ]
24 + then
25 + warn_msg "Interface ${GK_NET_IFACE} not found. Already down?"
26 + return
27 + fi
28 +
29 # If we are too quick and interface is still configuring IPv6
30 # waiting for DAD to complete due to received IPv6 RA, we have to
31 # wait.
32 @@ -1752,7 +1758,7 @@ kill_network() {
33 ip addr flush dev "${GK_NET_IFACE}"
34 ip route flush dev "${GK_NET_IFACE}"
35 ip link set "${GK_NET_IFACE}" down
36 - if grep -q "down" "/sys/class/net/${GK_NET_IFACE}/operstate"
37 + if grep -q "down" "/sys/class/net/${GK_NET_IFACE}/operstate" 2>/dev/null
38 then
39 break
40 fi