source: postlfs/config/netfs.xml@ f6d89c6

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb v5_1 v5_1-pre1 xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since f6d89c6 was f6d89c6, checked in by Igor Živković <igor@…>, 20 years ago

applied DJ's netfs patch

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1731 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 5.6 KB
Line 
1<sect1 id="postlfs-config-netfs" xreflabel="netfs">
2<?dbhtml filename="netfs.html" dir="postlfs"?>
3<title>Configuring for Network Filesystems</title>
4
5<para>While <acronym>LFS</acronym> is capable of mounting NFS volumes from
6the get go, the lfs-bootscripts are not quite ready for this configuration.
7Network filesystems should be unmounted before the network goes down. The
8<filename>netfs</filename> script below will prepare your LFS for mounting
9network filesystems at boot time, and unmounting them when the network
10is stopped.</para>
11
12<para> The following commands will create the <filename>netfs</filename>
13script:</para>
14
15<screen><command>cat &gt; /etc/rc.d/init.d/netfs &lt;&lt; "EOF"</command>
16#!/bin/sh
17# Begin $rc_base/init.d/netfs
18
19# Based on sysklogd script from LFS-3.1 and earlier.
20# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
21# netfs script written by Nathan Coulson - conathan@conet.dyndns.org
22# and by DJ Lucas - dj@lucasit.com
23
24. /etc/sysconfig/rc
25. $rc_functions
26
27case "$1" in
28
29 start)
30 # The following line mounts all entries in fstab that
31 # have the _netdev option. This is required for network
32 # filesystems to be mounted at boot time.
33 echo "Mounting network volumes..."
34 mount -a -O _netdev
35 evaluate_retval
36 ;;
37
38 stop)
39 echo -n "Unmounting network volumes..."
40
41 # The following line obtains a list from the output of
42 # mount for all netfs types and anything that was
43 # mounted with the _netdev option.
44 NETMOUNTS=`mount | grep '_netdev\|smbfs\|ncpfs|\coda\|nfs' \
45 | cut -d " " -f 3 | sed 's/$/ /g'`
46
47 # Check to see if anything was listed from above
48 # (see if anything is actually needs to be unmounted)
49 if [ x"$NETMOUNTS" != x ]
50 then
51 # There is something mounted
52 # terminate the echo -n above
53 echo " "
54
55 # Try and stop processes the nice way
56 # (probably won't work in most cases)
57 fuser -m -SIGTERM $NETMOUNTS &gt; /dev/null
58
59 # Check and see if it found anything. If it
60 # did, then give 3 seconds for things to exit
61 # the nice way before killing them off.
62 # This one will work all of the time!
63 if [ $? == 0 ]
64 then
65 sleep 3
66 fuser -km $NETMOUNTS &gt; /dev/null
67 fi
68
69 # We now need to unmount all network filesystems.
70 # We will do this with two umount commands to allow
71 # for broken behavior of smbmount, and also to make
72 # certain that netmounts without the _netdev option
73 # will still get unmounted.
74 umount -a -O _netdev
75 # save the retval
76 if [ $? != 0 ]
77 then
78 NERRVAL=1
79 fi
80
81 # Now catch the rest of the network filesystems
82 # by fstype. This list can be extended later as
83 # more network filesystems are supported by mount.
84 umount -a -t coda,ncpfs,nfs,smbfs
85 if [ $? == 0]
86 then
87 [ -z $NERRVAL ]
88 evaluate_retval
89 else
90 # make certain that we return an error
91 /bin/false
92 evaluate_retval
93 fi
94 else
95 # There is nothing mounted
96 echo "No network volumes mounted!"
97 # print a nice '[ OK ]' message
98 evaluate_retval
99 fi
100 ;;
101
102*)
103 echo "Usage: $0 {start|stop}"
104 exit 1
105 ;;
106esac
107
108# End $rc_base/init.d/netfs
109EOF
110<command>chmod 0755 /etc/rc.d/init.d/netfs</command></screen>
111
112<para>While the excessive comments in the script might make people cringe, the
113important part to note is that network filesystems that should be mounted at
114boot time, must have the <emphasis role="strong">_netdev</emphasis>
115option passed to them in <filename>/etc/fstab</filename>.</para>
116
117<para>Now put the necessary symlinks in place.</para>
118
119<screen><command>ln -sf ../init.d/netfs /etc/rc.d/rc0.d/K47netfs &amp;&amp;
120ln -sf ../init.d/netfs /etc/rc.d/rc1.d/K47netfs &amp;&amp;
121ln -sf ../init.d/netfs /etc/rc.d/rc2.d/K47netfs &amp;&amp;
122ln -sf ../init.d/netfs /etc/rc.d/rc3.d/S28netfs &amp;&amp;
123ln -sf ../init.d/netfs /etc/rc.d/rc4.d/S28netfs &amp;&amp;
124ln -sf ../init.d/netfs /etc/rc.d/rc5.d/S28netfs &amp;&amp;
125ln -sf ../init.d/netfs /etc/rc.d/rc6.d/K47netfs</command></screen>
126
127</sect1>
Note: See TracBrowser for help on using the repository browser.