Ticket #318: netfs

File netfs, 2.1 KB (added by DJ Lucas, 22 years ago)

New netfs script

Line 
1#!/bin/bash
2# Begin $rc_base/init.d/netfs
3
4# Based on sysklogd script from LFS-3.1 and earlier.
5# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
6
7source /etc/sysconfig/rc
8source $rc_functions
9
10case "$1" in
11 start)
12 echo "Mounting NFS volumes..."
13 mount -at nfs
14 evaluate_retval
15
16# This section left commented out, as smb mounts require a user's ID and
17# password. It is bad practice to include login info in a world readable file.
18# This section should only be uncomented if you are in a workgroup with a
19# common login ID and password. Even then, it is not a good idea!
20
21# echo "Mounting Samba shares..."
22# mount -at smbfs
23# evaluate_retval
24
25# This section is commented out as well for similar reasons. It also is not
26# yet a part of BLFS. I am unsure ATM if the Netware clients currently
27# availible include a way to directly mount a volume without first loging in,
28# or provide a way to pass login info to mount.
29
30# echo "Mounting Netware volumes..."
31# mount -at ncpfs
32# evaluate_retval
33 ;;
34
35
36 stop)
37 echo -n "Unmounting NFS volumes..."
38 NFSMOUNTS=$(awk 'BEGIN { ORS=" "} $3 ~ /nfs/ { print $2 }' \
39 /etc/mtab)
40 if [ "$NFSMOUNTS" != "" ]
41 then
42 echo " "
43 fuser -km $NFSMOUNTS >> /dev/null
44 umount $NFSMOUNTS >> /dev/null
45 evaluate_retval
46 else
47 echo " No NFS volumes mounted!"
48 evaluate_retval
49 fi
50
51 echo -n "Unmounting Samba shares..."
52 SMBMOUNTS=$(awk 'BEGIN { ORS=" "} $3 ~ /smbfs/ { print $2 }' \
53 /etc/mtab)
54 if [ "$SMBMOUNTS" != "" ]
55 then
56 echo ""
57 fusrer -km $SMBMOUNTS >> /dev/null
58 umount $SMBMOUNTS >> /dev/null
59 evaluate_retval
60 else
61 echo " No Samba shares mounted!"
62 evaluate_retval
63 fi
64
65 echo -n "Unmounting Netware volumes..."
66 NCPMOUNTS=$(awk 'BEGIN { ORS=" "} $3 ~ /ncpfs/ { print $2 }' \
67 /etc/mtab)
68 if [ "$NCPMOUNTS" != "" ]
69 then
70 echo ""
71 fuser -km $NCPMOUNTS >> /dev/null
72 umount $NCPMOUNTS /dev/null
73 evaluate_retval
74 else
75 echo " No Netware volumes mounted!"
76 evaluate_retval
77 fi
78 ;;
79
80 *)
81 echo "Usage: $0 {start|stop}"
82 exit 1
83 ;;
84esac
85
86# End $rc_base/init.d/netfs
87