Redo argv processing to better conform to standards. A NULL argv is no
[dragonfly.git] / contrib / smbfs / examples / smbfs.sh.sample
1 #!/bin/sh
2 #
3 # $Id: smbfs.sh.sample,v 1.3 2001/01/13 04:50:36 bp Exp $
4 #
5 # Location: /usr/local/etc/rc.d/smbfs.sh
6 #
7 # Simple script to mount smbfs file systems at startup.
8 # It assumes that all mount points described in fstab file and password
9 # entries listed in /root/.nsmbrc file. See mount_smbfs(8) for details.
10 #
11
12 mount="/sbin/mount -o -N"
13 umount=/sbin/umount
14 HOME=/root; export HOME
15 vols=`awk -- '/^\/.*[[:space:]]+smbfs[[:space:]]+/ { print $2 }' /etc/fstab`
16
17 case "$1" in
18 start)
19         echo -n "smbfs: "
20         for vol in ${vols}; do
21                 $mount $vol
22                 echo -n "$vol "
23         done
24         ;;
25 stop)
26         echo -n "unmounting smbfs mount points: "
27         for vol in ${vols}; do
28                 $umount $vol
29                 echo -n "$vol "
30         done
31         ;;
32 *)
33         echo "Usage: `basename $0` {start|stop}" >&2
34         exit 64
35 esac
36
37 echo "Done"