From 5874b61d02b7f6b3281bfe765315bdd450751263 Mon Sep 17 00:00:00 2001 From: Pavel Zhukov Date: Thu, 22 Feb 2018 13:43:07 +0100 Subject: [PATCH] Do not try to parse sysconfig/network-scripts if initscrips is not installed --- dhclient-script | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dhclient-script b/dhclient-script index 14735b5..abce85d 100644 --- a/dhclient-script +++ b/dhclient-script @@ -813,10 +813,14 @@ if [ -f /etc/sysconfig/networking/network ]; then . /etc/sysconfig/networking/network fi -cd /etc/sysconfig/network-scripts -CONFIG="${interface}" -need_config "${CONFIG}" -source_config >/dev/null 2>&1 +## it's possible initscripts package is not installed +## for example in container. Don't flood stderr then +if [ -d /etc/sysconfig/network-scripts ]; then + cd /etc/sysconfig/network-scripts + CONFIG="${interface}" + need_config "${CONFIG}" + source_config >/dev/null 2>&1 +fi; # In case there's some delay in rebinding, it might happen, that the valid_lft drops to 0, # address is removed by kernel and then re-added few seconds later by dhclient-script.