--- /dev/null
+# $Id$
+# This is an automounter map and it has the following format
+# key [ -mount-options-separated-by-comma ] location
+# Details may be found in the autofs(5) manpage
+
+kernel -ro,soft,intr ftp.kernel.org:/pub/linux
+cd -fstype=iso9660,ro :/dev/cdrom
+
+# the following entries are samples to pique your imagination
+#floppy -fstype=auto :/dev/fd0
+#floppy -fstype=ext2 :/dev/fd0
+#e2floppy -fstype=ext2 :/dev/fd0
+#jaz -fstype=ext2 :/dev/sdc1
--- /dev/null
+# This is an automounter map and it has the following format
+# key [ -mount-options-separated-by-comma ] location
+# Details may be found in the autofs(5) manpage
+
+kernel -ro ftp.kernel.org:/pub/linux
+cdrom -fstype=iso9660,ro,nodev,nosuid :/dev/cdrom
+# Beware that popping out a floppy disc while it is mounted is a VERY
+# DANGEROUS OPERATION, and can result in disc corruption. If you have
+# a floppy drive where this is possible (i.e. most PCs), you are warned!
+#floppy -fstype=auto,nodev,nosuid :/dev/fd0
+
+# The following are to give you some additional ideas
+#zip -fstype=ext2 :/dev/hdc
+#jaz -fstype=auto :/dev/sda
--- /dev/null
+#!/bin/sh
+
+# $Id$
+
+# Look at what a host is exporting to determine what we can mount.
+# This is very simple, but it appears to work surprisingly well
+
+key="$1"
+opts="-fstype=nfs,hard,intr,nodev,nosuid"
+
+# Showmount comes in a number of names and varieties. "showmount" is
+# typically an older version which accepts the '--no-headers' flag
+# but ignores it. "kshowmount" is the newer version installed with knfsd,
+# which both accepts and acts on the '--no-headers' flag.
+#SHOWMOUNT="kshowmount --no-headers -e $key"
+#SHOWMOUNT="showmount -e $key | tail +2"
+
+# Newer distributions get this right
+SHOWMOUNT="showmount --no-headers -e $key"
+
+$SHOWMOUNT | sort +0 | sed -e "s|^\([^ ]*\).*|$key\1 $opts $key:\1|"
# Get network config
. /etc/sysconfig/network
-# Get service config
-[ -f /etc/sysconfig/inetd ] && . /etc/sysconfig/inetd
-
# Check that networking is up.
if [ "${NETWORKING}" = "no" ]; then
echo "WARNING: Networking is down. Autofs service can't be runed."
exit 1
fi
+DAEMON=usr/sbin/automount
# We can add local options here
# e.g. localoptions='rsize=8192,wsize=8192'
getmounts()
{
#
-# Check for local maps to be loaded
+# Check for local maps to be loaded
#
if [ -f /etc/autofs/auto.master ]
then
if [ ! -z "$dir" -a ! -z "$map" \
-a x`echo "$map" | cut -c1` != 'x-' ]
then
- map=`echo "/etc/autofs/$map" | sed -e 's:^/etc/autofs/:/:'`
- # special: treat -t or --timeout (or any reasonable derivative)
- # specially, since it can't be made a normal mount option.
- if echo $options | grep -- '-t' >/dev/null 2>&1 ; then
- mountoptions="--timeout $(echo $options | \
- sed 's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"
- fi
- options=`echo "$options" | sed -e '
- s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
- s/\(^\|[ \t]\)-/\1/g'`
+ map=`echo "/etc/autofs/$map" | sed -e 's:^/etc\/autofs//:/:'`
+ options=`echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'`
if [ -x $map ]; then
- echo "/usr/sbin/automount $mountoptions $dir program $map $options $localoptions"
+ echo "$DAEMON $daemonoptions $dir program $map $options $localoptions"
elif [ -f $map ]; then
- echo "/usr/sbin/automount $mountoptions $dir file $map $options $localoptions"
+ echo "$DAEMON $daemonoptions $dir file $map $options $localoptions"
else
- echo "/usr/sbin/automount $mountoptions $dir `basename $map` $options $localoptions"
+ echo "$DAEMON $daemonoptions $dir `basename $map` $options $localoptions"
fi
fi
done
fi
#
-# Check for YellowPage maps to be loaded
+# Check for YellowPage maps to be loaded
#
if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
then
mountoptions="--timeout $(echo $options | \
sed 's/^.*-t\(imeout\)*[ \t]*\([0-9][0-9]*\).*$/\2/g')"
fi
- options=`echo "$options" | sed -e '
- s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
- s/\(^\|[ \t]\)-/\1/g'`
- echo "/usr/sbin/automount $mountoptions $dir yp $map $options $localoptions"
+ options=`echo "$options" | sed -e '
+ s/--*t\(imeout\)*[ \t]*[0-9][0-9]*//g
+ s/\(^\|[ \t]\)-/\1/g'`
+ echo "$DAEMON $daemonoptions $mountoptions $dir yp $map $options $localoptions"
fi
done
)
if [ ! -f /var/lock/subsys/automount ]; then
show Starting automounter
busy
- getmounts | sh
- deltext
- ok
+ if getmounts | sh; then
+ deltext;ok
+ else
+ deltext;ok
+ fi
else
echo "automount already is running"
fi