summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt J. Bosch <kjb-temp-2009@alpenjodel.de>2011-07-05 23:01:06 +0200
committerTom Gundersen <teg@jklm.no>2011-07-10 21:54:37 +0200
commita16cbaeda9ee38d581e8556cc31cc9aa10afb9d2 (patch)
treea4e17638b946b6f9f2b83ff961072ecce225dea7
parent89a56bde72418c289155b3eb5725f10f146899f6 (diff)
netfs: Refactor to provide meaningful exit code
Get rid of simple if-clauses and provide meaningfull exit code. Maybe someone wants to abort suspend to disk/ram or something if umount fails or even start this in a loop.
-rwxr-xr-xnetfs21
1 files changed, 7 insertions, 14 deletions
diff --git a/netfs b/netfs
index fff8482..ffda681 100755
--- a/netfs
+++ b/netfs
@@ -4,32 +4,24 @@
. /etc/rc.conf
. /etc/rc.d/functions
-rc=0
-
case "$1" in
start)
stat_busy "Mounting Network Filesystems"
mount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
rc=$?
mount -a -O _netdev
- if ((rc + $? > 0)); then
- stat_fail
- else
- add_daemon netfs
- stat_done
- fi
+ (( rc || $? )) && stat_die
+ add_daemon netfs
+ stat_done
;;
stop)
stat_busy "Unmounting Network Filesystems"
umount -a -O _netdev
rc=$?
umount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
- if ((rc + $? > 0)); then
- stat_fail
- else
- rm_daemon netfs
- stat_done
- fi
+ (( rc || $? )) && stat_die
+ rm_daemon netfs
+ stat_done
;;
restart)
$0 stop
@@ -38,6 +30,7 @@ case "$1" in
;;
*)
echo "usage: $0 {start|stop|restart}"
+ exit 1
esac
# vim: set ts=2 noet: