From owner-autofs@linux.kernel.org Fri Apr 16 14:10:38 1999 Return-Path: Received: from linux.kernel.org (majordom@linux.kernel.org [206.184.214.34]) by mail.Linux-Consulting.com (8.8.7/8.8.7) with ESMTP id OAA03930 for ; Fri, 16 Apr 1999 14:10:37 -0700 Received: (from majordom@localhost) by linux.kernel.org (8.9.1/8.9.1) id NAA28342 for autofs-list; Fri, 16 Apr 1999 13:25:09 -0700 Received: from front6.grolier.fr (front6.grolier.fr [194.158.96.56]) by linux.kernel.org (8.9.1/8.9.1) with ESMTP id NAA28337 for ; Fri, 16 Apr 1999 13:25:07 -0700 Received: from dimitri.localdomain (ppp-195-36-223-70.pop.club-internet.fr [195.36.223.70]) by front6.grolier.fr (8.9.3/No_Relay+No_Spam_MGC990224) with ESMTP id WAA08598 for ; Fri, 16 Apr 1999 22:24:59 +0200 (MET DST) Received: from club-internet.fr (dimitri.localdomain [127.0.0.1]) by dimitri.localdomain (8.8.7/8.8.7/Dimitri) with ESMTP id WAA00661 for ; Fri, 16 Apr 1999 22:10:59 +0200 Message-ID: <37179953.7DE481E@club-internet.fr> Date: Fri, 16 Apr 1999 22:10:59 +0200 From: Dimitri Papadopoulos X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.34 i586) X-Accept-Language: en MIME-Version: 1.0 To: autofs@linux.kernel.org Subject: Re: troubles with samples/rc.autofs References: <370296F7.9A6F36F4@club-internet.fr> Content-Type: multipart/mixed; boundary="------------3E6E21E00158B84C13BB20A2" Sender: owner-autofs@linux.kernel.org Precedence: bulk Status: RO This is a multi-part message in MIME format. --------------3E6E21E00158B84C13BB20A2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, For your information, here is the modified autofs script that I have tested on a RedHat 5.1 workstation in a an environment with Sun NIS servers. The default script does not work in that case. Except for some cosmetic modifications, the intent was: - If a local master map does exist, do not read the NIS master map. Indeed, the NIS master map cannot be understood because it uses options Solaris can understand but automount cannot (such as direct mounts). Default script merges both master maps if they exist. Is this useful? - In the case of a local master.map, try to read NIS secondary maps. For example, I was interested in reading the NIS auto.home map, although I had to install a local /etc/auto.master map for the above reasons. I hope this script can be of some help... If someone wants to include such modifications to the autofs package, I'd all too happy to help. --------------3E6E21E00158B84C13BB20A2 Content-Type: text/plain; charset=us-ascii; name="autofs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="autofs" #! /bin/bash # # $Id: rc.autofs,v 1.3 1998/03/28 03:22:38 hpa Exp $ # # /etc/rc.d/init.d/autofs # # rc file for automount using a Sun-style "master map". # We first look for a local /etc/auto.master, then a YP # map with that name # # chkconfig: - 72 08 # description: automatically mounts filesystems when you use \ # them, and unmounts them later when you are not using them. # processname: automount # Note that there may be multiple processes names automount # config: /etc/auto.master # Note that all other config files are automatically reloaded # and may be different on different systems; we can ignore them # here # # note: # Modifie par Dimitri pour marcher avec un /etc/auto.master # local qui contient une reference vers un auto.home NIS. # # # Source function library. # . /etc/rc.d/init.d/functions # # This is the automount daemon. # test -x /usr/sbin/automount || exit 0 # # We can add local options here # e.g. localoptions='rsize=8192,wsize=8192' # localoptions='' # # 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 # 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'` nismap=$map [ x`echo "$map" | cut -c1` = 'x/' ] || map="/etc/$map" if [ -x $map ]; then echo "/usr/sbin/automount $mountoptions $dir program $map $options $localoptions" elif [ -f $map ]; then echo "/usr/sbin/automount $mountoptions $dir file $map $options $localoptions" elif [ -x /usr/bin/ypcat ] \ && ypcat -k "$nismap" >/dev/null 2>&1 ; then echo "/usr/sbin/automount $mountoptions $dir yp $nismap $options $localoptions" else echo "/usr/sbin/automount $mountoptions $dir `basename $map` $options $localoptions" fi fi done ) # # Check for YellowPage maps to be loaded # elif [ -x /usr/bin/ypcat ] && ypcat -k auto.master 2>/dev/null 1>&2 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'` echo "/usr/sbin/automount $mountoptions $dir yp $map $options $localoptions" fi done ) fi } # # See how we were called. # case "$1" in start) # Check if the automounter is already running? if [ ! -f /var/lock/subsys/automount ]; then echo 'Starting automounter: ' getmounts | sh touch /var/lock/subsys/automount fi ;; stop) kill -TERM $(/sbin/pidof /usr/sbin/automount) rm -f /var/lock/subsys/automount ;; reload|restart) if [ ! -f /var/lock/subsys/automount ]; 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] /usr/sbin/automount " | ( 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) echo "Configured Mount Points:" getmounts echo "" echo "Active Mount Points:" ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( while read pid tt stat time command; do echo $command; done ) ;; *) echo "Usage: /etc/rc.d/init.d/autofs {start|stop|restart|reload|status}" exit 1 esac exit 0 --------------3E6E21E00158B84C13BB20A2--