diff options
-rw-r--r-- | contrib/fedora/rpm/NetworkManager.spec | 3 | ||||
-rwxr-xr-x | examples/dispatcher/10-ifcfg-rh-routes.sh | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 70884ffa0d..cf95985c5e 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -454,7 +454,8 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-down.d -%{__cp} examples/dispatcher/10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d +%{__cp} examples/dispatcher/10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/ +%{__ln_s} ../10-ifcfg-rh-routes.sh $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/dispatcher.d/pre-up.d/ %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/gnome-vpn-properties diff --git a/examples/dispatcher/10-ifcfg-rh-routes.sh b/examples/dispatcher/10-ifcfg-rh-routes.sh index 78f009ef67..75b8c5e5e9 100755 --- a/examples/dispatcher/10-ifcfg-rh-routes.sh +++ b/examples/dispatcher/10-ifcfg-rh-routes.sh @@ -5,7 +5,12 @@ # interfaces that have routing rules associated with them that can't # be expressed by NMSettingIPConfig. (Eg, policy-based routing.) -# This should be installed in dispatcher.d/pre-up.d/ +# This should be installed in both dispatcher.d/ and +# dispatcher.d/pre-up.d/ + +if [ "$2" != "pre-up" -a "$2" != "down" ]; then + exit 0 +fi dir=$(dirname "$CONNECTION_FILENAME") if [ "$dir" != "/etc/sysconfig/network-scripts" ]; then @@ -15,7 +20,15 @@ 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 - /etc/sysconfig/network-scripts/ifup-routes "$DEVICE_IP_IFACE" "$profile" +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 |