Files
NetworkManager/examples/dispatcher/10-ifcfg-rh-routes.sh
Thomas Haller bc7ad75d99 contrib/rpm: install pre-up dispatcher script "10-ifcfg-rh-routes.sh" as no-wait
The main reason to introduce the "no-wait.d" dispatcher directory was
"10-ifcfg-rh-routes.sh", which (as a pre-up script) delays activation.
We even extracted the script to a separate package on RHEL to avoid
delays by default.

Invoke the script via no-wait.d.
2016-01-08 14:27:18 +01:00

38 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# This ifcfg-rh-specific script runs
# /etc/sysconfig/network-scripts/ifup-routes when bringing up
# interfaces that have routing rules associated with them that can't
# be expressed by NMSettingIPConfig. (Eg, policy-based routing.)
# This should be installed in both dispatcher.d/ and
# dispatcher.d/pre-up.d/
# pre-up scripts delay activation of the device. To reduce the delay,
# it is adviced to install the script as symlink to no-wait.d directory.
if [ "$2" != "pre-up" -a "$2" != "down" ]; then
exit 0
fi
dir=$(dirname "$CONNECTION_FILENAME")
if [ "$dir" != "/etc/sysconfig/network-scripts" ]; then
exit 0
fi
profile=$(basename "$CONNECTION_FILENAME" | sed -ne 's/^ifcfg-//p')
if [ -z "$profile" ]; then
exit 0
fi
if ! [ -f "$dir/rule-$profile" -o -f "$dir/rule6-$profile" ]; then
exit 0
fi
case "$2" in
pre-up)
/etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile"
;;
down)
/etc/sysconfig/network-scripts/ifdown-routes "$DEVICE_IP_IFACE" "$profile"
;;
esac