autofs
i want to use autofs to automatically mount my cdrom and floppy when i insert them
is this possible? it would also be nice to have a cdrom icon come up on my kde desktop when i insert the cd, does anyone know a way to do this?
my rc.autofs is such:
#!/bin/bash
#
# Slackware rc file for automount (file type maps only)
# Severely handicapped rc.autofs.in from autofs-3.1.7 package
# Andrei Osin <osin@izmiran.ru>
#
# In Slackware, this file should be called:
# /etc/rc.d/rc.autofs
if [ ! -f /etc/slackware-version ]; then
echo "This is not a Slackware system" 1>&2
exit 1
fi
#
# Location of the automount daemon
#
DAEMON=`whereis -b automount|cut -d' ' -f2`
test -e $DAEMON || exit 1
# Additional map options
localoptions=''
# This function will build a list of automount commands to execute in
# order to activate all the mount points.
function getmounts()
{
#
# Check for local maps to be loaded
#
if [ -f /etc/auto.master ]
then
cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
# These are automount options
while read dir map options
do
if [ -f $map ]; then
echo "$DAEMON $options $dir file $map $localoptions"
fi
done
)
fi
}
#
# Status lister.
#
function status()
{
test `ps ax|grep -c automount` -eq 0 &&
echo Automount is not running &&
exit
echo "Configured Mount Points:"
echo "------------------------"
getmounts | cut -d' ' -f3
echo ""
echo "Active Mount Points:"
echo "--------------------"
getmounts | cut -d' ' -f3 | while read dir
do
mount | grep -v automount | grep $dir | cut -d' ' -f3
done
}
case "$1" in
start)
# Check if the automounter is already running?
if [ ! -f /var/lock/subsys/autofs ]; then
echo 'Starting automounter: '
getmounts | cut -d' ' -f3
getmounts | sh
touch /var/lock/subsys/autofs
fi
;;
stop)
kill -TERM $(/sbin/pidof $DAEMON)
rm -f /var/lock/subsys/autofs
;;
reload|restart)
if [ ! -f /var/lock/subsys/autofs ]; then
echo "Automounter not running"
exit 1
fi
echo "Checking for changes to /etc/auto.master ..."
TMP1=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >& 2; exit 1; }
TMP2=`mktemp /tmp/autofs.XXXXXX` || { echo "could not make temp file" >& 2; exit 1; }
getmounts >$TMP1
ps ax|grep "[0-9]:[0-9][0-9] $DAEMON " | (
while read pid tt stat time command; do
echo "$command" >>$TMP2
if ! grep -q "^$command" $TMP2; then
kill -USR2 $pid
echo "Stop $command"
fi
done
)
cat $TMP1 | ( while read x; do
if ! grep -q "^$x" $TMP2; then
$x
echo "Start $x"
fi
done )
rm -f $TMP1 $TMP2
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
and my auto.master:
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(8).
/mnt/auto /etc/auto.misc --timeout=3
and my auto.misc:
# 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
cdrom -fstype=iso9660,user,ro :/dev/cdrom
floppy -fstype=vfat,user,iocharset=koi8-r :/dev/fd0
i was under the impression that this was all that was required to get it to mount cds and floppies upon insertion, oh yes of course with starting it in rc.local of course
rc.local:
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local setup commands in here:
automount --timeout=3 /mnt/auto file /etc/auto.misc
anyone?
|