aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian La Roche <laroche@redhat.com>2002-06-26 10:49:31 +0000
committerFlorian La Roche <laroche@redhat.com>2002-06-26 10:49:31 +0000
commitffe40c20ad49f24c5546ddd0af9629233c2a0651 (patch)
treece4f8f7558c1e622fed4673427968342b38050bd
parente4088390f4a3d8f3d3a59befb8b571b07826f523 (diff)
downloadinitscripts-ffe40c20ad49f24c5546ddd0af9629233c2a0651.tar
initscripts-ffe40c20ad49f24c5546ddd0af9629233c2a0651.tar.gz
initscripts-ffe40c20ad49f24c5546ddd0af9629233c2a0651.tar.bz2
initscripts-ffe40c20ad49f24c5546ddd0af9629233c2a0651.tar.xz
initscripts-ffe40c20ad49f24c5546ddd0af9629233c2a0651.zip
- change some negation usage
-rwxr-xr-xsysconfig/network-scripts/ifup-ipx6
-rwxr-xr-xsysconfig/network-scripts/ifup-sit12
-rwxr-xr-xsysconfig/network-scripts/init.ipv6-global11
-rw-r--r--sysconfig/network-scripts/network-functions-ipv646
4 files changed, 32 insertions, 43 deletions
diff --git a/sysconfig/network-scripts/ifup-ipx b/sysconfig/network-scripts/ifup-ipx
index 4d03d833..c08e91c4 100755
--- a/sysconfig/network-scripts/ifup-ipx
+++ b/sysconfig/network-scripts/ifup-ipx
@@ -8,10 +8,8 @@ if [ "$1" = "" ]; then
exit 1
fi
-if [ ! -x /sbin/ipx_interface ] ; then
- # cannot configure IPX with non-existant utilities
- exit 0
-fi
+# cannot configure IPX with non-existant utilities
+[ -x /sbin/ipx_interface ] || exit 0
. /etc/sysconfig/network
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index 0ad99784..b26432c2 100755
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -46,11 +46,7 @@ REALDEVICE=`echo ${DEVICE} | sed 's/:.*//g'`
# Test whether IPv6 should be configured, else stop
[ "${NETWORKING_IPV6}" = "yes" ] || exit 0
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-# Source IPv6 helper functions
+[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
@@ -80,17 +76,17 @@ fi
ipv6_add_tunnel_device $DEVICE $IPV6TUNNELIPV4 "" $IPV6TUNNELIPV4LOCAL || exit 1
# Set IPv6 MTU, if given
-if [ ! -z "$IPV6_MTU" ]; then
+if [ -n "$IPV6_MTU" ]; then
ipv6_set_mtu $DEVICE $IPV6_MTU
fi
# Apply local IPv6 address, if given (numbered tunnel)
-if [ ! -z "$IPV6ADDR" ]; then
+if [ -n "$IPV6ADDR" ]; then
ipv6_add_addr_on_device $DEVICE $IPV6ADDR
fi
# Setup default IPv6 route, check are done by function
-if [ ! -z "$IPV6_DEFAULTDEV" -o ! -z "$IPV6_DEFAULTGW" ]; then
+if [ -n "$IPV6_DEFAULTDEV" -o -n "$IPV6_DEFAULTGW" ]; then
ipv6_set_default_route "$IPV6_DEFAULTGW" "$IPV6_DEFAULTDEV" "$DEVICE"
fi
diff --git a/sysconfig/network-scripts/init.ipv6-global b/sysconfig/network-scripts/init.ipv6-global
index fa380391..262bc2f7 100755
--- a/sysconfig/network-scripts/init.ipv6-global
+++ b/sysconfig/network-scripts/init.ipv6-global
@@ -45,14 +45,9 @@ POSITION="$2"
# Test whether IPv6 should be configured, else stop
[ "${NETWORKING_IPV6}" = "yes" ] || exit 0
-if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
- exit 1
-fi
-
-# Source IPv6 helper functions
+[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
-
# Initialize IPv6, depending on caller option
case $ACTION in
start)
@@ -115,9 +110,9 @@ case $ACTION in
# Set default route for autotunnel, if specified
if [ "$IPV6_DEFAULTDEV" = "sit0" -a "$IPV6_AUTOTUNNEL" = "yes" ]; then
- if [ ! -z "$IPV6_DEFAULTGW" ]; then
+ if [ -n "$IPV6_DEFAULTGW" ]; then
ipv6_set_default_route $IPV6_DEFAULTGW $IPV6_DEFAULTDEV sit0
- elif [ ! -z "$IPV6_DEFAULTDEV" ]; then
+ elif [ -n "$IPV6_DEFAULTDEV" ]; then
ipv6_set_default_route "" $IPV6_DEFAULTDEV sit0
fi
fi
diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6
index 95dcb08c..9661f651 100644
--- a/sysconfig/network-scripts/network-functions-ipv6
+++ b/sysconfig/network-scripts/network-functions-ipv6
@@ -91,7 +91,7 @@ ipv6_log() {
local fnawk="print \$$fn"
local t="`echo $level | awk -F. "{ $fnawk }"`"
- if [ ! -z "$t" ]; then
+ if [ -n "$t" ]; then
echo $"ERROR: [ipv6_log] Loglevel isn't valid '$level' (arg 2)" >/dev/stderr
return 1
fi
@@ -128,7 +128,7 @@ ipv6_log() {
;;
esac
- [ ! -z "$txt_name" ] && local txt_name="$txt_name "
+ [ -n "$txt_name" ] && local txt_name="$txt_name "
if [ "$channel" = "stderr" ]; then
echo "$txt_level: ${txt_name}${message}" >/dev/stderr
@@ -138,7 +138,7 @@ ipv6_log() {
;;
'syslog')
- if [ ! -x logger ]; then
+ if ! [ -x logger ]; then
echo $"ERROR: [ipv6_log] Syslog is chosen, but binary 'logger' doesn't exist or isn't executable" >/dev/stderr
return 3
fi
@@ -200,16 +200,16 @@ ipv6_test() {
fi
fi
- if [ ! -d /proc/sys/net/ipv6/conf/ ]; then
+ if ! [ -d /proc/sys/net/ipv6/conf/ ]; then
return 2
fi
- if [ ! -x /sbin/ip ]; then
+ if ! [ -x /sbin/ip ]; then
ipv6_log $"Utility 'ip' (package: iproute) doesn't exist or isn't executable - stop" crit $fn
return 2
fi
- if [ ! -x /sbin/sysctl ]; then
+ if ! [ -x /sbin/sysctl ]; then
ipv6_log $"Utility 'sysctl' (package: procps) doesn't exist or isn't executable - stop" crit $fn
return 2
fi
@@ -311,7 +311,7 @@ ipv6_control_forwarding() {
fi
# Per device control (not implemented in kernel)
- if [ ! -z "$fw_device" ]; then
+ if [ -n "$fw_device" ]; then
ipv6_log $"IPv6 forwarding per device cannot be controlled via sysctl - use netfilter6 instead" warn $fn
fi
@@ -358,7 +358,7 @@ ipv6_add_route() {
fi
fi
- if [ ! -z "$returntxt" ]; then
+ if [ -n "$returntxt" ]; then
if echo $returntxt | grep -q "File exists"; then
# Netlink: "File exists"
true
@@ -448,7 +448,7 @@ ipv6_cleanup_routes() {
# Get all IPv6 routes through given interface and remove them
ipv6_exec_route -A inet6 -n | LC_ALL=C grep "$device\W*$" | while read ipv6net nexthop flags metric ref use iface args; do
if [ "$iface" = "$device" ]; then
- if [ ! -z "$gatewaymatch" ]; then
+ if [ -n "$gatewaymatch" ]; then
# Test if given gateway matches
if [ "$gatewaymatch" != "$nexthop" ]; then
continue
@@ -574,7 +574,7 @@ ipv6_test_addr_exists_on_device() {
else
local testresult="`LC_ALL=C grep "$test_addr .. $test_prefixlength $test_scope .." /proc/net/if_inet6 | LC_ALL=C grep $testdevice$`"
fi
- if [ ! -z "$testresult" ]; then
+ if [ -n "$testresult" ]; then
# exists
return 0
else
@@ -584,7 +584,7 @@ ipv6_test_addr_exists_on_device() {
else
# low budget version, only works if given address is in equal form like "ip" displays
local testresult="`ipv6_exec_ip addr show dev $testdevice | LC_ALL=C grep inet6 | awk '{ print $2 }' | LC_ALL=C grep -i "^$testaddr/$testprefix$"`"
- if [ ! -z "$testresult" ]; then
+ if [ -n "$testresult" ]; then
# exits
return 0
else
@@ -621,7 +621,7 @@ ipv6_test_addrprefix_exists_on_device() {
# For the moment: low budget version, only works if given address is in equal form like "ip" displays
local testresult="`ipv6_exec_ip addr show dev $testdevice | LC_ALL=C grep inet6 | awk '{ print $2 }' | LC_ALL=C grep -i "^$testaddrprefix:"`"
- if [ ! -z "$testresult" ]; then
+ if [ -n "$testresult" ]; then
# exists
return 0
else
@@ -799,7 +799,7 @@ ipv6_test_ipv6_addr_valid() {
if [ -z "$testipv6addr_valid" ]; then
return 1
fi
- if [ ! -z "$modequiet" ]; then
+ if [ -n "$modequiet" ]; then
if [ "$modequiet" != "quiet" ]; then
ipv6_log $"Parameter '$modequiet' for 'quiet' mode is not valid (arg 2)" err $fn
return 1
@@ -862,7 +862,7 @@ ipv6_test_ipv4_addr_valid() {
if [ -z "$testipv4addr_valid" ]; then
return 1
fi
- if [ ! -z "$modequiet" ]; then
+ if [ -n "$modequiet" ]; then
if [ "$modequiet" != "quiet" ]; then
ipv6_log $"Parameter '$modequiet' for 'quiet' mode is not valid (arg 2)" err $fn
return 1
@@ -1239,7 +1239,7 @@ ipv6_add_tunnel_device() {
ipv6_exec_sysctl -w -e net.ipv6.conf.$device.accept_ra=0 >/dev/null
ipv6_exec_sysctl -w -e net.ipv6.conf.$device.accept_redirects=0 >/dev/null
- if [ ! -z "$addressipv6local" ]; then
+ if [ -n "$addressipv6local" ]; then
# Setup P-t-P address
ipv6_add_addr_on_device $device $addressipv6local
if [ $? -ne 0 ]; then
@@ -1462,7 +1462,7 @@ ipv6_set_default_route() {
local address=""
fi
- if [ ! -z "$address" ]; then
+ if [ -n "$address" ]; then
local addressgw=`echo $address | awk -F% '{ print $1 }'`
local device_scope=`echo $address | awk -F% '{ print $2 }'`
@@ -1472,7 +1472,7 @@ ipv6_set_default_route() {
fi
# Scope device has precedence
- if [ ! -z "$device_scope" -a ! -z "$device" -a "$device_scope" != "$device" ]; then
+ if [ -n "$device_scope" -a ! -z "$device" -a "$device_scope" != "$device" ]; then
ipv6_log $"Given IPv6 default gateway '$address' has scope '$device_scope' defined, given default gateway device '$device' will be not used" inf $fn
local device=""
fi
@@ -1488,12 +1488,12 @@ ipv6_set_default_route() {
fi
# Check whether the route belongs to the specific given interface
- if [ ! -z "$device_check" ]; then
+ if [ -n "$device_check" ]; then
# Check whether scope device matches given check device
- if [ ! -z "$device_scope" -a "$device_check" != "$device_scope" ]; then
+ if [ -n "$device_scope" -a "$device_check" != "$device_scope" ]; then
# scope device != specific given -> skip
return 0
- elif [ ! -z "$device" -a "$device_check" != "$device" ]; then
+ elif [ -n "$device" -a "$device_check" != "$device" ]; then
# gateway device != specific given -> skip
return 0
fi
@@ -1512,9 +1512,9 @@ ipv6_set_default_route() {
#ipv6_add_route ::/0 $addressgw $device
ipv6_add_route 2000::/3 $addressgw $device
fi
- elif [ ! -z "$device" ]; then
+ elif [ -n "$device" ]; then
# Check whether the route belongs to the specific given interface
- if [ ! -z "$device_check" -a "$device_check" != "$device" ]; then
+ if [ -n "$device_check" -a "$device_check" != "$device" ]; then
# gateway device != specific given -> skip
return 0
fi
@@ -1629,7 +1629,7 @@ ipv6_trigger_radvd() {
# PID file needed?
if [ "$action" = "SIGHUP" ]; then
- if [ ! -f "$pidfile" ]; then
+ if ! [ -f "$pidfile" ]; then
ipv6_log $"Given pidfile '$pidfile' doesn't exist, cannot send trigger to radvd" err $fn
return 3
fi