[arch-projects] [initscripts] [PATCH 16/17] netfs: Refactor to get rid of simple if-clauses and provide meaningfull exit code
Kurt J. Bosch
kjb-temp-2009 at alpenjodel.de
Tue Jul 5 18:02:28 EDT 2011
Maybe someone wants to abort suspend to disk/ram or something if umount fails.
---
netfs | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/netfs b/netfs
index c2fcfc9..85c08be 100755
--- a/netfs
+++ b/netfs
@@ -10,24 +10,18 @@ case "$1" in
mount -a -t nfs,nfs4,smbfs,codafs,ncpfs,cifs,shfs,glusterfs,fuse,fuseblk,fuse.glusterfs,davfs
rc=$?
mount -a -O _netdev
- if (( rc || $? )); 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 || $? )); then
- stat_fail
- else
- rm_daemon netfs
- stat_done
- fi
+ (( rc || $? )) && stat_die
+ rm_daemon netfs
+ stat_done
;;
restart)
$0 stop
@@ -36,6 +30,7 @@ case "$1" in
;;
*)
echo "usage: $0 {start|stop|restart}"
+ exit 1
esac
# vim: set ts=2 noet:
--
1.7.1
More information about the arch-projects
mailing list