commit: 057ede0d95124961692e5b67cd30eef5d305724b
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 18 17:23:36 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 18 17:23:36 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=057ede0d
initrd.scripts: start_network(): Don't try to start network when interface is
missing
In addition, try to detect when udhcpc failed.
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
defaults/initrd.scripts | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index e93a5ad..9e70c00 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1664,10 +1664,21 @@ start_network() {
esac
done
+ if [ ! -d "/sys/class/net/${GK_NET_IFACE}" ]
+ then
+ warn_msg "Interface ${GK_NET_IFACE} not found; Will not try to
start network ..."
+ return
+ fi
+
if [ -z "${IP}" -o "${IP}" = 'dhcp' ]
then
good_msg "Bringing up interface ${GK_NET_IFACE} using dhcp ..."
${QUIET}
busybox udhcpc -i "${GK_NET_IFACE}" -n -t
${GK_NET_DHCP_RETRIES} -T ${GK_NET_TIMEOUT_DHCP} -R -p "${GK_NET_DHCP_PIDFILE}"
+ if [ $? -ne 0 ]
+ then
+ bad_msg "Failed to start udhcpc for interface
${GK_NET_IFACE}!"
+ return
+ fi
else
good_msg "Bringing up interface ${GK_NET_IFACE} ..." ${QUIET}
ip link set "${GK_NET_IFACE}" up