aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2009-12-19 15:57:03 +0200
committerBill Nottingham <notting@redhat.com>2010-01-12 17:09:10 -0500
commit265989c6fce9523b46aa9020f241ab2450307aa4 (patch)
tree168538aa78bb8280848af13978f56fef5caf2c05 /rc.d
parentd4c58cd1c84f99030c3f4778d2c64377838e0634 (diff)
downloadinitscripts-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 'rc.d')
-rw-r--r--rc.d/init.d/functions4
-rwxr-xr-xrc.d/init.d/halt8
-rwxr-xr-xrc.d/init.d/killall6
-rwxr-xr-xrc.d/init.d/netfs4
-rwxr-xr-xrc.d/init.d/network2
-rwxr-xr-xrc.d/rc4
-rwxr-xr-xrc.d/rc.sysinit28
7 files changed, 28 insertions, 28 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 09f11b8f..2b117d58 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -18,7 +18,7 @@ export PATH
[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="$(/sbin/consoletype)"
-if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" -a -z "${LANGSH_SOURCED:-}" ] ; then
+if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n ] ; then
. /etc/profile.d/lang.sh 2>/dev/null
# avoid propagating LANGSH_SOURCED any further
unset LANGSH_SOURCED
@@ -157,7 +157,7 @@ __pids_var_run() {
read line
[ -z "$line" ] && break
for p in $line ; do
- [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid $p"
+ [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] && pid="$pid $p"
done
done < "$pid_file"
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 8cb437fc..94d4fb08 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -78,7 +78,7 @@ esac
# Find mdmon pid's and omit killing them
OMITARGS=
for i in /dev/.mdadm/*.pid; do
- if [ "$i" = "mdadm.pid" -o ! -r "$i" ]; then
+ if [ "$i" = "mdadm.pid" ] || [ ! -r "$i" ]; then
continue
fi
OMITARGS="$OMITARGS -o $(cat $i)"
@@ -95,7 +95,7 @@ fi
/sbin/halt -w
# Save mixer settings, here for lack of a better place.
-if [ -s /etc/alsa/alsactl.conf -a -x /sbin/alsactl -a -w /etc/asound.state ]; then
+if [ -s /etc/alsa/alsactl.conf ] && [ -x /sbin/alsactl ] && [ -w /etc/asound.state ]; then
action $"Saving mixer settings" /sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --ignore store
fi
@@ -188,12 +188,12 @@ elif [ -f /forcefsck ]; then
fi
# Shutdown UPS drivers
-if [ "$command" = /sbin/halt -a -f /etc/sysconfig/ups ]; then
+if [ "$command" = /sbin/halt ] && [ -f /etc/sysconfig/ups ]; then
. /etc/sysconfig/ups
if [ -z $POWERDOWNFLAG ]; then
POWERDOWNFLAG=/etc/killpower
fi
- if [ "$SERVER" = "yes" -a -f $POWERDOWNFLAG ]; then
+ if [ "$SERVER" = "yes" ] && [ -f $POWERDOWNFLAG ]; then
/sbin/upsdrvctl shutdown
fi
fi
diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall
index d22982ef..c1169b10 100755
--- a/rc.d/init.d/killall
+++ b/rc.d/init.d/killall
@@ -24,10 +24,10 @@ for i in /var/lock/subsys/* ; do
[ $subsys = network ] && continue
# Bring the subsystem down.
- if [ -f /etc/init.d/$subsys.init ]; then
- /etc/init.d/$subsys.init stop
- elif [ -f /etc/init.d/$subsys ]; then
+ if [ -f /etc/init.d/$subsys ]; then
/etc/init.d/$subsys stop
+ elif [ -f /etc/init.d/$subsys.init ]; then
+ /etc/init.d/$subsys.init stop
else
rm -f "$i"
fi
diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs
index 17cea9f8..6294aeb9 100755
--- a/rc.d/init.d/netfs
+++ b/rc.d/init.d/netfs
@@ -32,7 +32,7 @@ NETDEVMTAB=$(LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab)
# See how we were called.
case "$1" in
start)
- [ ! -f /var/lock/subsys/network -a ! -f /var/lock/subsys/NetworkManager ] && exit 0
+ [ ! -f /var/lock/subsys/network ] && [ ! -f /var/lock/subsys/NetworkManager ] && exit 0
[ "$EUID" != "0" ] && exit 4
[ -n "$NFSFSTAB" ] &&
{
@@ -46,7 +46,7 @@ case "$1" in
if [ -f /etc/mdadm.conf ]; then
mdadm -A -s
fi
- if [ -f /etc/multipath.conf -a -x /sbin/multipath ]; then
+ if [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then
modprobe dm-multipath >/dev/null 2>&1
/sbin/multipath -v 0
if [ -x /sbin/kpartx ]; then
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 52845ae3..07df54e0 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -34,7 +34,7 @@ fi
[ -x /sbin/ip ] || exit 1
# Even if IPX is configured, without the utilities we can't do much
-[ ! -x /sbin/ipx_internal_net -o ! -x /sbin/ipx_configure ] && IPX=
+[ ! -x /sbin/ipx_internal_net ] || [ ! -x /sbin/ipx_configure ] && IPX=
# Even if VLAN is configured, without the utility we can't do much
[ ! -x /sbin/vconfig ] && VLAN=
diff --git a/rc.d/rc b/rc.d/rc
index 73d266ab..678bb5e5 100755
--- a/rc.d/rc
+++ b/rc.d/rc
@@ -51,7 +51,7 @@ fi
# Set language, vc settings once to avoid doing it for every init script
# through functions
-if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" ] ; then
+if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n ] ; then
. /etc/profile.d/lang.sh 2>/dev/null
export LANGSH_SOURCED=1
fi
@@ -61,7 +61,7 @@ for i in /etc/rc$runlevel.d/K* ; do
# Check if the subsystem is already up.
subsys=${i#/etc/rc$runlevel.d/K??}
- [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] || continue
+ [ -f /var/lock/subsys/$subsys ] || [ -f /var/lock/subsys/$subsys.init ] || continue
check_runlevel "$i" || continue
# Bring the subsystem down.
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 2713dd83..b602a7ba 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -42,7 +42,7 @@ if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]
fi
fi
-if [ -n "$SELINUX_STATE" -a -x /sbin/restorecon ] && __fgrep " /dev " /proc/mounts >/dev/null 2>&1 ; then
+if [ -n "$SELINUX_STATE" ] && [ -x /sbin/restorecon ] && __fgrep " /dev " /proc/mounts >/dev/null 2>&1 ; then
/sbin/restorecon -R /dev 2>/dev/null
fi
@@ -348,8 +348,8 @@ if [ -f /etc/crypttab ]; then
init_crypto 0
fi
-if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf -a \
- -x /sbin/multipath ]; then
+if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && \
+ [ -x /sbin/multipath ]; then
modprobe dm-multipath > /dev/null 2>&1
/sbin/multipath -v 0
if [ -x /sbin/kpartx ]; then
@@ -373,7 +373,7 @@ if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then
fi
# Start any MD RAID arrays that haven't been started yet
-[ -f /etc/mdadm.conf -a -x /sbin/mdadm ] && /sbin/mdadm -As --auto=yes --run
+[ -f /etc/mdadm.conf ] && [ -x /sbin/mdadm ] && /sbin/mdadm -As --auto=yes --run
if [ -x /sbin/lvm ]; then
action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --ignorelockingfailure
@@ -490,7 +490,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
*)
;;
esac
- [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
+ [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path"
done
done
@@ -552,14 +552,14 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
for path in $(grep -v "^#" "$file" 2>/dev/null); do
mount_state "$path"
- [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
+ [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path"
done
done
if [ -f "$STATE_MOUNT/files" ] ; then
for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do
mount_state "$path"
- [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
+ [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path"
done
fi
fi
@@ -570,7 +570,7 @@ if [[ " $fsckoptions" != *" -y"* ]]; then
fi
_RUN_QUOTACHECK=0
-if [ -f /forcequotacheck ] || strstr "$cmdline" forcequotacheck ; then
+if strstr "$cmdline" forcequotacheck || [ -f /forcequotacheck ] ; then
_RUN_QUOTACHECK=1
fi
if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
@@ -649,7 +649,7 @@ fi
# If relabeling, relabel mount points.
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
- if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then
+ if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then
restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1
fi
fi
@@ -680,7 +680,7 @@ else
fi
# Update quotas if necessary
-if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
+if [ X"$_RUN_QUOTACHECK" = X1 ] && [ -x /sbin/quotacheck ]; then
action $"Checking local filesystem quotas: " /sbin/quotacheck -anug
fi
@@ -690,11 +690,11 @@ fi
# Check to see if a full relabel is needed
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
- if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then
+ if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then
relabel_selinux
fi
else
- if [ -d /etc/selinux -a "$READONLY" != "yes" ]; then
+ if [ "$READONLY" != "yes" ] && [ -d /etc/selinux ]; then
[ -f /.autorelabel ] || touch /.autorelabel
fi
fi
@@ -756,7 +756,7 @@ rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \
# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might...
_NEED_XFILES=
-[ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
+[ -f /var/run/utmpx ] || [ -f /var/log/wtmpx ] && _NEED_XFILES=1
# Clean up /var.
rm -rf /var/lock/cvs/* /var/run/screen/*
@@ -831,7 +831,7 @@ touch /.autofsck &> /dev/null
if [ "$PROMPT" != no ]; then
while :; do
pid=$(/sbin/pidof getkey)
- [ -n "$pid" -o -e /var/run/getkey_done ] && break
+ [ -n "$pid" ] || [ -e /var/run/getkey_done ] && break
usleep 100000
done
[ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1