mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 12:30:32 +01:00
dispatcher: move return-early checks in "10-ifcfg-rh-routes.sh" first
A shell script is executed line-by-line. Note that for most dispatcher events, "10-ifcfg-rh-routes.sh" has nothing to do and will just quit. Move those checks earlier, to avoid bash executing the code that won't be needed most of the time.
This commit is contained in:
parent
5a24ad53ad
commit
babd1f314e
1 changed files with 18 additions and 18 deletions
|
|
@ -12,6 +12,24 @@
|
|||
# This file is derived from scripts 'if{up,down}-routes' from
|
||||
# Fedora/RHEL initscripts.
|
||||
|
||||
if [ "$2" != "pre-up" ] && [ "$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" ] && [ ! -f "$dir/rule6-$profile" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MATCH='^[[:space:]]*(\#.*)?$'
|
||||
|
||||
handle_file () {
|
||||
|
|
@ -45,24 +63,6 @@ handle_ip_file() {
|
|||
}
|
||||
|
||||
|
||||
if [ "$2" != "pre-up" ] && [ "$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" ] && [ ! -f "$dir/rule6-$profile" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$2" in
|
||||
pre-up)
|
||||
# Routes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue