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: 1563470616.057ede0d95124961692e5b67cd30eef5d305724b.whissi@gentoo
1 commit: 057ede0d95124961692e5b67cd30eef5d305724b
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 18 17:23:36 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 18 17:23:36 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=057ede0d
7
8 initrd.scripts: start_network(): Don't try to start network when interface is missing
9
10 In addition, try to detect when udhcpc failed.
11
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 defaults/initrd.scripts | 11 +++++++++++
15 1 file changed, 11 insertions(+)
16
17 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
18 index e93a5ad..9e70c00 100644
19 --- a/defaults/initrd.scripts
20 +++ b/defaults/initrd.scripts
21 @@ -1664,10 +1664,21 @@ start_network() {
22 esac
23 done
24
25 + if [ ! -d "/sys/class/net/${GK_NET_IFACE}" ]
26 + then
27 + warn_msg "Interface ${GK_NET_IFACE} not found; Will not try to start network ..."
28 + return
29 + fi
30 +
31 if [ -z "${IP}" -o "${IP}" = 'dhcp' ]
32 then
33 good_msg "Bringing up interface ${GK_NET_IFACE} using dhcp ..." ${QUIET}
34 busybox udhcpc -i "${GK_NET_IFACE}" -n -t ${GK_NET_DHCP_RETRIES} -T ${GK_NET_TIMEOUT_DHCP} -R -p "${GK_NET_DHCP_PIDFILE}"
35 + if [ $? -ne 0 ]
36 + then
37 + bad_msg "Failed to start udhcpc for interface ${GK_NET_IFACE}!"
38 + return
39 + fi
40 else
41 good_msg "Bringing up interface ${GK_NET_IFACE} ..." ${QUIET}
42 ip link set "${GK_NET_IFACE}" up