aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2003-01-07 04:58:31 +0000
committerBill Nottingham <notting@redhat.com>2003-01-07 04:58:31 +0000
commit3061c823c0566c5efeefae12d48d4bb95c2acc7a (patch)
tree28a7d440413737f252d2afd4052920af67f09741 /rc.d/init.d
parent52475e10f05f0f29437bce4ccf2d2d7560ead764 (diff)
downloadinitscripts-3061c823c0566c5efeefae12d48d4bb95c2acc7a.tar
initscripts-3061c823c0566c5efeefae12d48d4bb95c2acc7a.tar.gz
initscripts-3061c823c0566c5efeefae12d48d4bb95c2acc7a.tar.bz2
initscripts-3061c823c0566c5efeefae12d48d4bb95c2acc7a.tar.xz
initscripts-3061c823c0566c5efeefae12d48d4bb95c2acc7a.zip
speedups (<drepper@redhat.com>)
- use LC_ALL=C - don't use both grep&awk on the same file, just use awk
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-xrc.d/init.d/netfs30
-rwxr-xr-xrc.d/init.d/network8
-rwxr-xr-xrc.d/init.d/rawdevices10
3 files changed, 25 insertions, 23 deletions
diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs
index 1fff48ce..204e262b 100755
--- a/rc.d/init.d/netfs
+++ b/rc.d/init.d/netfs
@@ -19,13 +19,13 @@
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
-NFSFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'`
-SMBFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^smbfs$/ && $4 !~ /noauto/) print $2}'`
-NCPFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^ncpfs$/ && $4 !~ /noauto/) print $2}'`
-NETDEVMTAB=`grep -v '^#' /proc/mounts | awk '{ if (($4 ~ /_netdev/) && ($2 != "/")) print $2}'`
-NFSMTAB=`grep -v '^#' /proc/mounts | awk '{ if (($3 ~ /nfs$/) && ($2 != "/")) print $2}'`
-SMBMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^smbfs$/ ) print $2}'`
-NCPMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^ncpfs$/ ) print $2}'`
+NFSFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "nfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab`
+SMBFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "smbfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab`
+NCPFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "ncpfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab`
+NETDEVMTAB=`LC_ALL=C awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" { print $2 }' /proc/mounts`
+NFSMTAB=`LC_ALL=C awk '!/^#/ && $3 == "nfs" && $2 != "/" { print $2 }' /proc/mounts`
+SMBMTAB=`LC_ALL=C awk '!/^#/ && $3 == "smbfs" { print $2 }' /proc/mounts`
+NCPMTAB=`LC_ALL=C awk '!/^#/ && $3 == "ncpfs" { print $2 }' /proc/mounts`
# See how we were called.
case "$1" in
@@ -42,8 +42,8 @@ case "$1" in
;;
stop)
# Unmount loopback stuff first
- remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
- devremaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
+ devremaining=`LC_ALL=C awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
[ -n "$remaining" ] && {
sig=
retry=3
@@ -58,8 +58,8 @@ case "$1" in
losetup $dev >/dev/null 2>&1 && \
action $"Detaching loopback device $dev: " losetup -d $dev
done
- remaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
- devremaining=`awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts`
+ devremaining=`LC_ALL=C awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $1}' /proc/mounts`
[ -z "$remaining" ] && break
/sbin/fuser -k -m $sig $remaining >/dev/null
sleep 5
@@ -70,7 +70,7 @@ case "$1" in
[ -n "$NETDEVMTAB" ] && {
sig=
retry=3
- remaining=`awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /proc/mounts`
while [ -n "$remaining" -a "$retry" -gt 0 ]
do
if [ "$retry" -lt 3 ]; then
@@ -79,7 +79,7 @@ case "$1" in
action $"Unmounting network block filesystems: " umount -a -O _netdev
fi
sleep 2
- remaining=`awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $4 ~ /_netdev/ && $2 != "/" {print $2}' /proc/mounts`
[ -z "$remaining" ] && break
/sbin/fuser -k -m $sig $remaining >/dev/null
sleep 5
@@ -90,7 +90,7 @@ case "$1" in
[ -n "$NFSMTAB" ] && {
sig=
retry=3
- remaining=`awk '!/^#/ && $3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
while [ -n "$remaining" -a "$retry" -gt 0 ]
do
if [ "$retry" -lt 3 ]; then
@@ -99,7 +99,7 @@ case "$1" in
action $"Unmounting NFS filesystems: " umount -f -l -a -t nfs
fi
sleep 2
- remaining=`awk '!/^#/ && $3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
+ remaining=`LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $2 != "/" {print $2}' /proc/mounts`
[ -z "$remaining" ] && break
/sbin/fuser -k -m $sig $remaining >/dev/null
sleep 5
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 364b5567..55d5c111 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -86,7 +86,7 @@ case "$1" in
# bring up all other interfaces configured to come up at boot time
for i in $interfaces; do
- eval $(fgrep "DEVICE=" ifcfg-$i)
+ eval $(LANG=C fgrep "DEVICE=" ifcfg-$i)
if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi
if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then
@@ -166,9 +166,9 @@ case "$1" in
# and unmount them even if the user didn't turn on netfs
if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then
- NFSMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^nfs$/ ) print $2}'`
- SMBMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^smbfs$/ ) print $2}'`
- NCPMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^ncpfs$/ ) print $2}'`
+ NFSMTAB=`LC_ALL=C awk '!/^#/ && $3 == "nfs" { print $2 }' /proc/mounts`
+ SMBMTAB=`LC_ALL=C awk '!/^#/ && $3 == "smbfs" { print $2 }' /proc/mounts`
+ NCPMTAB=`LC_ALL=C awk '!/^#/ && $3 == "ncpfs" { print $2 }' /proc/mounts`
if [ -n "$NFSMTAB" -o -n "$SMBMTAB" -o -n "$NCPMTAB" ] ; then
/etc/init.d/netfs stop
fi
diff --git a/rc.d/init.d/rawdevices b/rc.d/init.d/rawdevices
index b55fa14f..e0639279 100755
--- a/rc.d/init.d/rawdevices
+++ b/rc.d/init.d/rawdevices
@@ -13,22 +13,24 @@
[ -f /usr/bin/raw ] || exit 0
[ -f /etc/sysconfig/rawdevices ] || exit 0
# Exit if the file just has the default comments.
-/bin/grep -q -v "^#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0
+LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0
. /etc/init.d/functions
function assign_raw()
{
- cat /etc/sysconfig/rawdevices | egrep -v '^ *#' | while read RAW BLOCK; do
+ LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
+ while read RAW BLOCK; do
if [ -n "$RAW" -a -n "$BLOCK" ]; then
- if [ "`dirname $RAW`" = "/dev" -a -d /dev/raw ]; then
+ rawdirname=${RAW%/*}
+ if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
echo $" Please correct your /etc/sysconfig/rawdevices:"
echo $" rawdevices are now located in the directory /dev/raw/ "
echo $" If the command 'raw' still refers to /dev/raw as a file."
echo $" you'll have to upgrade your util-linux package"
exit 0
fi
- if [ "`dirname $RAW`" = "/dev/raw" -a -f /dev/raw ]; then
+ if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
echo $" Please correct your /etc/sysconfig/rawdevices:"
echo $" rawdevices are now located in the directory /dev/raw/ "
echo $" If the command 'raw' still refers to /dev/raw as a file."