aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2019-07-18 19:23:36 +0200
committerThomas Deutschmann <whissi@gentoo.org>2019-07-18 19:23:36 +0200
commit057ede0d95124961692e5b67cd30eef5d305724b (patch)
treeb0d357ce882abc2e3a131d6ffa663f20e909f68f
parentarch/x86_64/modules_load: Add e1000e network driver (diff)
downloadgenkernel-057ede0d95124961692e5b67cd30eef5d305724b.tar.gz
genkernel-057ede0d95124961692e5b67cd30eef5d305724b.tar.bz2
genkernel-057ede0d95124961692e5b67cd30eef5d305724b.zip
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@gentoo.org>
-rw-r--r--defaults/initrd.scripts11
1 files changed, 11 insertions, 0 deletions
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