Here's a first cut that does (2) with a slight modification to mountnfs.
If DELAYNFS=yes is set in /etc/default/rcS then it will exit the script
unless all auto configured interfaces are up.
There may be a better way of figuring out which interfaces are set to
auto, but this ones works for all on individual lines or specified on a
single line.
There may also be a better way of deciding if the interface has been
configured rather than just looking at the ifstate file
Comments welcome
Phil
Vogler, Hartmut wrote:
I can think of 2 solutions. One is to add an option to 'mount'.
similar in operation to _netdev, but with the ability to specify an
interface. Not too keen on this one as it affects more than Debian
based distributions.
Two, add a 'delay_nfsmount' or similar to the startup scripts. This
would have the effect of not calling mountnfs until the last auto
interface is brought up.
If there is some sensible way to acheive this through the current
if-pre-up.d or if-up.d mechanisms that can be documented, that would
also be acceptable.
The second solution seems to be OK - this is the most compatible way.
The first solution opens the posibility, to umount nfs volumes in
if-down.d sequence. But this would often hangs, if the affected
directory is in use.
Soo i think you should realize the second version!
Regards
Hartmut
diff -Naur mountnfs.orig mountnfs
--- mountnfs.orig 2007-09-05 09:19:06.000000000 +1200
+++ mountnfs 2007-09-05 14:16:27.000000000 +1200
@@ -113,6 +113,21 @@
}
+# If DELAYNFS=yes in /etc/default/rcS, do not attempt to mount any NFS mounts until
+# all auto interfaces are up
+if [ yes = "$DELAYNFS" ]; then
+
+ grep "^[:space:]*auto" /etc/network/interfaces | sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]/\n/g' | while read i; do
+ if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then
+ echo "Waiting for interface $i before NFS mounts"
+ mkdir /var/run/network/mountnfs_earlyexit 2> /dev/null
+ fi
+ done
+ if [ -d /var/run/network/mountnfs_earlyexit ]; then
+ rmdir /var/run/network/mountnfs_earlyexit 2>/dev/null
+ exit 0
+ fi
+fi
# Using 'no !=' instead of 'yes =' to make sure async nfs mounting is
# the default even without a value in /etc/default/rcS
if [ no != "$ASYNCMOUNTNFS" ]; then