diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2009-12-19 15:57:03 +0200 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2010-01-12 17:09:10 -0500 |
commit | 265989c6fce9523b46aa9020f241ab2450307aa4 (patch) | |
tree | 168538aa78bb8280848af13978f56fef5caf2c05 /sysconfig/network-scripts | |
parent | d4c58cd1c84f99030c3f4778d2c64377838e0634 (diff) | |
download | initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.gz initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.bz2 initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.tar.xz initscripts-265989c6fce9523b46aa9020f241ab2450307aa4.zip |
Eliminate bunch of unnecessary stat calls and command invocations.
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x | sysconfig/network-scripts/ifdown-eth | 6 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifdown-ppp | 2 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 2 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 6 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-ippp | 8 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-ipsec | 2 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 05d44174..3399ee3c 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -105,7 +105,7 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then fi [ "$retcode" = "0" ] && retcode=$? -if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then +if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then /sbin/ip link set dev ${DEVICE} down /usr/sbin/brctl delif ${BRIDGE} ${DEVICE} # Upon removing a device from a bridge, @@ -128,7 +128,7 @@ while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do done # don't leave an outdated key sitting around -if [ -n "${WIRELESS_ENC_KEY}" -a -x /sbin/iwconfig ]; then +if [ -n "${WIRELESS_ENC_KEY}" ] && [ -x /sbin/iwconfig ]; then /sbin/iwconfig ${DEVICE} enc 0 >/dev/null 2>&1 fi @@ -138,7 +138,7 @@ if [ "$retcode" = 0 ] ; then # the interface went down. fi -if [ -n "$VLAN" -a -x /sbin/vconfig ]; then +if [ -n "$VLAN" ] && [ -x /sbin/vconfig ]; then # 802.1q VLAN if echo ${DEVICE} | LANG=C grep -Ev '(:)' | LANG=C grep -Eq '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' \ || echo ${DEVICE} | LANG=C grep -Eq 'vlan[0-9][0-9]?[0-9]?[0-9]?' ; then diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp index 2827c7e5..fca64638 100755 --- a/sysconfig/network-scripts/ifdown-ppp +++ b/sysconfig/network-scripts/ifdown-ppp @@ -13,7 +13,7 @@ fi CONFIG=${CONFIG##ifcfg-} -if [ "${DEMAND}" = "yes" -a -f /var/run/ppp-${CONFIG}.pid ] ; then +if [ "${DEMAND}" = "yes" ] && [ -f /var/run/ppp-${CONFIG}.pid ] ; then PID=$(head -1 /var/run/ppp-${CONFIG}.pid) kill -TERM ${PID} sleep 2 diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 2f85e2d0..e3b01478 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -66,7 +66,7 @@ then fi # Ethernet 802.1Q VLAN support -if [ -x /sbin/vconfig -a "${VLAN}" = "yes" -a "$ISALIAS" = "no" ]; then +if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -x /sbin/vconfig ]; then VID="" MATCH='^(eth|hsi|bond)[0-9]+\.[0-9]{1,4}$' if [[ "${DEVICE}" =~ $MATCH ]]; then diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 634cb4fe..c0169192 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -150,7 +150,7 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then fi # If the device is part of a bridge, add the device to the bridge -if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then +if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then if [ ! -d /sys/class/net/${BRIDGE}/bridge ]; then /usr/sbin/brctl addbr ${BRIDGE} 2>/dev/null fi @@ -167,7 +167,7 @@ if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then exit 0 fi -if [ -n "${DYNCONFIG}" -a -x /sbin/dhclient ]; then +if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then ONESHOT=""; else @@ -270,7 +270,7 @@ else # Set a default route. if [ "${DEFROUTE}" != "no" ] && [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then # set up default gateway. replace if one already exists - if [ -n "${GATEWAY}" -a "$(ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then + if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then ip route replace default ${METRIC:+metric $METRIC} \ via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \ ${GATEWAYDEV:+dev $GATEWAYDEV} diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp index 643b2a8c..7cfe6f39 100755 --- a/sysconfig/network-scripts/ifup-ippp +++ b/sysconfig/network-scripts/ifup-ippp @@ -23,20 +23,20 @@ if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then exit fi -if [ ! -f /var/lock/subsys/isdn -a -x /etc/init.d/isdn ] ; then +if [ ! -f /var/lock/subsys/isdn ] && [ -x /etc/init.d/isdn ] ; then /etc/init.d/isdn start fi # check that ipppd is available for syncppp if [ "$ENCAP" = "syncppp" ]; then - if [ ! -x /usr/sbin/ipppd -a ! -x /sbin/ipppd ] ; then + if [ ! -x /sbin/ipppd ] && [ ! -x /usr/sbin/ipppd ] ; then /usr/bin/logger -p daemon.info -t ifup-ippp "ipppd does not exist or is not executable" exit 1 fi fi # check that isdnctrl is available -if [ ! -x /usr/sbin/isdnctrl -a ! -x /sbin/isdnctrl ] ; then +if [ ! -x /sbin/isdnctrl ] && [ ! -x /usr/sbin/isdnctrl ] ; then /usr/bin/logger -p daemon.info -t ifup-ippp "isdnctrl does not exist or is not executable" exit 1 fi @@ -74,7 +74,7 @@ function start_ibod() [ -f /var/lock/subsys/ibod ] && return device=$1 - if [ -f /etc/isdn/ibod.cf -a -x /usr/sbin/ibod ] ; then + if [ -f /etc/isdn/ibod.cf ] && [ -x /usr/sbin/ibod ] ; then ibod $device & pid=$(pidof ibod) [ -n "$pid" ] && touch /var/lock/subsys/ibod diff --git a/sysconfig/network-scripts/ifup-ipsec b/sysconfig/network-scripts/ifup-ipsec index 4411451c..2d40cc28 100755 --- a/sysconfig/network-scripts/ifup-ipsec +++ b/sysconfig/network-scripts/ifup-ipsec @@ -211,7 +211,7 @@ if [ "$KEYING" = "automatic" -a -n "$IKE_METHOD" ]; then echo "$DST $IKE_PSK" >> $tmpfile mv -f $tmpfile /etc/racoon/psk.txt fi - if [ ! -f /etc/racoon/$DST.conf -o /etc/racoon/$DST.conf -ot $1 ] ; then + if [ ! -f /etc/racoon/$DST.conf ] || [ /etc/racoon/$DST.conf -ot $1 ] ; then cat > /etc/racoon/$DST.conf << EOF remote $DST { diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index e357c0f2..e1c0d6fa 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -58,7 +58,7 @@ need_config () nconfig=$(LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \ /etc/sysconfig/network-scripts/ifcfg-* \ | LC_ALL=C sed -e "$__sed_discard_ignored_files") - if [ -n "$nconfig" -a -f "$nconfig" ]; then + if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then CONFIG=${nconfig##*/} return fi |