#!/bin/sh # # rc.autofs - Starts the filesystem automounter # Last modified 12-Dec-2000 by David Cantrell, # # # This function will build a list of automount commands to execute in # order to activate all the mount points. It is used to figure out # the difference of automount points in case of a reload # function getmounts() { # Check for local maps to be loaded if [ -f /etc/auto.master ] then cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| ( while read dir map options do if [ ! -z "$dir" -a ! -z "$map" \ -a x`echo "$map" | cut -c1` != 'x-' ] then map=`echo "/etc/$map" | sed -e 's:^/etc//:/:'` options=`echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'` if [ ! -d $dir ] then mkdir -p $dir fi if [ -x $map ] then echo "/usr/sbin/automount $dir program $map $options $localoptions" elif [ -f $map ] then echo "/usr/sbin/automount $dir file $map $options $localoptions" else echo "/usr/sbin/automount $dir `basename $map` $options $localoptions" fi fi done ) fi # Check for NIS maps to be loaded if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ] then ypcat -k auto.master | ( while read dir map options do if [ ! -z "$dir" -a ! -z "$map" \ -a x`echo "$map" | cut -c1` != 'x-' ] then map=`echo "$map" | sed -e 's/^auto_/auto./'` 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'` if [ ! -d $dir ] then mkdir -p $dir fi echo "/usr/sbin/automount $dir yp $map $options $localoptions" fi done ) fi } getmounts | sh