aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-08-30 15:18:31 +0100
committerColin Guthrie <colin@mageia.org>2014-08-30 15:18:31 +0100
commitbcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa (patch)
tree76b6771401c5b387d6695a800ca0339f6355106c /sysconfig
parent909b3cc7f81cb8406b5d82b2dfd0559c101ae9f1 (diff)
downloadinitscripts-bcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa.tar
initscripts-bcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa.tar.gz
initscripts-bcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa.tar.bz2
initscripts-bcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa.tar.xz
initscripts-bcb4e37b4cf4bc5b79509165cf2444a0ffcae0fa.zip
Try and handle more NetworkManager errors.
These generally don't matter too much but they look bad. This change should both log a bit more (tailored for network service runs where newlines are suppressed - thus not quite as nice when running ifup manually, but nicer in the journal log for network.service) It should also handle some more cases where there is no DEVICE variable (typically when the device is not present and the ifcfg- file does not set it explicitly, or when it is set explicitly but it's not plugged in)
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifup24
1 files changed, 21 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 0380ec9e..d146ca48 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -70,14 +70,32 @@ fi
if [ "$_use_nm" = "true" ]; then
if [ -z "$UUID" ]; then
- echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2
+ # OK, so we are using NM but we have no UUID... not much we can do but
+ # leaving it for now and hoping NM brings it up later
+ echo -n "deferring to NetworkManager " >&2
exit 0
fi
if [ "foo$2" = "fooboot" ] && [ "${TYPE}" = "Wireless" ]; then
+ echo -n "deferring boot-time wireless device to NetworkManager " >&2
exit 0
fi
- is_nm_handling ${DEVICE} && exit 0
- nmcli con up uuid "$UUID"
+
+ # If we don't have a device, this is typically due to removable interface
+ # (e.g. USB ethernet adapters)
+ # This check may apply to non-NM devices too, but I cannot test if this is
+ # valid in all cases so only dealing gracefully with it here.
+ if [ -z "${DEVICE}" ]; then
+ echo -n "no device found: deferring to NetworkManager " >&2
+ exit 0
+ fi
+
+ if is_nm_handling ${DEVICE}; then
+ echo -n "deferred to NetworkManager " >&2
+ exit 0
+ fi
+
+ unset OVERRIDEEXIT
+ nmcli con up uuid "$UUID" 2>&1 | grep -q "no device found for connection" && echo -n "no device found - deferring to NetworkManager " && OVERRIDEEXIT=y; ( [ "y" = "$OVERRIDEEXIT" ] && exit 0; exit ${PIPESTATUS[0]} )
exit $?
fi