diff options
author | Bill Nottingham <notting@redhat.com> | 2003-01-07 04:58:31 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2003-01-07 04:58:31 +0000 |
commit | 3061c823c0566c5efeefae12d48d4bb95c2acc7a (patch) | |
tree | 28a7d440413737f252d2afd4052920af67f09741 /rc.d/init.d/netfs | |
parent | 52475e10f05f0f29437bce4ccf2d2d7560ead764 (diff) | |
download | initscripts-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/netfs')
-rwxr-xr-x | rc.d/init.d/netfs | 30 |
1 files changed, 15 insertions, 15 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 |