]>
git.saurik.com Git - apple/launchd.git/blob - launchd/src/StartupItems/NFS
9 AUTOMOUNTDIR
=/private
/var
/automount
14 if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi
15 lockfile
-r 0 /var
/run
/NFS.StartupItem
|| exit 0
20 echo "Starting network file system"
22 if [ -d ${AUTOMOUNTDIR} ]; then
23 chflags
-R nouchg
${AUTOMOUNTDIR}
24 rm -rf ${AUTOMOUNTDIR}
27 # nsfiod is the NFS asynchronous block I/O daemon, which implements
28 # NFS read-ahead and write-behind caching on NFS clients.
32 # The rpc.lockd/rpc.statd daemons are needed on both the client and
33 # the server in order to support file locking over NFS.
35 # If NFSLOCKS = -AUTOMATIC-, we start the daemons if we are a server
36 # but if we are only a client, we start the daemons once we know we
41 # gather list of NFS exports
43 exports_ni
=$(niutil -list . /exports 2> /dev/null | wc -w)
44 # Look for exports in /etc/exports, ignoring comments and blank lines.
45 exports_etc
=$(grep -v '^[[:space:]]*\(#\|$\)' /etc/exports 2> /dev/null | wc -l)
46 exports=$(($exports_ni + $exports_etc))
48 # if we are an NFS server, turn on NFS locking by default:
49 if [ "${exports}" -gt 0 ]; then
50 if [ "${NFSLOCKS:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
55 if [ "${NFSLOCKS:=-AUTOMATIC-}" = "-YES-" ]; then
56 # we definitely want locks on, so turn them on now
60 if [ "${NFSLOCKS:=-AUTOMATIC-}" = "-AUTOMATIC-" ]; then
61 # delay starting daemons until we know we need them
63 # invoke rpc.statd to send any SM_NOTIFY messages and quit.
66 # -w says to wait for signal from kernel, then start daemons
74 # If exportfs finds something to export (either using /etc/exports or the
75 # exports NetInfo directory), then start the NFS daemons (which service
76 # NFS requests) and the mount server (which services NFS mount requests).
78 # Clear the table of exported filesystems.
79 rm -f /var/db/mountdtab
81 if [ "${exports}" -gt 0 ]; then
82 echo "Starting Network File System server"
85 # If the NetInfo config/nfsd directory contains startup args for nfsd, use those.
86 arguments=`niutil -readprop . /config/nfsd arguments`
87 if [ "${arguments}" = "" ]; then
88 arguments="-t -u -n 6"
94 # Start the automounter
97 if [ "${AUTOMOUNT:=-YES-}" = "-YES-" ]; then
98 automount -m /Network -nsl -mnt ${AUTOMOUNTDIR}
99 ln -s /automount/Library /Network/Library
100 automount -m /automount/Servers -fstab -mnt /private/Network/Servers \
101 -m /automount/static -static -mnt ${AUTOMOUNTDIR}
102 ln -s /automount/Servers /Network/Servers
105 # Hint that the name /Network should be localized:
107 ln -s . /Network/.localized
111 # Leave a mark upon completion of the automounter startup:
113 touch /var/run/automount.initialized