diff options
author | Kurt J. Bosch <kjb-temp-2009@alpenjodel.de> | 2011-07-05 23:01:06 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-07-10 21:54:37 +0200 |
commit | a16cbaeda9ee38d581e8556cc31cc9aa10afb9d2 (patch) | |
tree | a4e17638b946b6f9f2b83ff961072ecce225dea7 | |
parent | 89a56bde72418c289155b3eb5725f10f146899f6 (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-x | netfs | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -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: |