diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2005-03-15 04:18:38 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2005-03-15 04:18:38 +0000 |
commit | 81527e780e8d5d51740a9edc7999106b0bbddde4 (patch) | |
tree | a059fb327031dceb8407baedb08d2eef72fd76a8 /net-fs | |
parent | Mark ~amd64. Closes #85171 (diff) | |
download | gentoo-2-81527e780e8d5d51740a9edc7999106b0bbddde4.tar.gz gentoo-2-81527e780e8d5d51740a9edc7999106b0bbddde4.tar.bz2 gentoo-2-81527e780e8d5d51740a9edc7999106b0bbddde4.zip |
Bug #82086 - totally revamp the init script, now supports all daemon options. Also cleanup all usage of unsafe sub-shells.
(Portage version: 2.0.51.19)
Diffstat (limited to 'net-fs')
-rw-r--r-- | net-fs/autofs/ChangeLog | 10 | ||||
-rw-r--r-- | net-fs/autofs/Manifest | 19 | ||||
-rw-r--r-- | net-fs/autofs/autofs-4.1.3-r4.ebuild | 86 | ||||
-rw-r--r-- | net-fs/autofs/files/autofs.rc10 | 236 | ||||
-rw-r--r-- | net-fs/autofs/files/autofs.rc11 | 279 | ||||
-rw-r--r-- | net-fs/autofs/files/autofs.rc12 | 288 | ||||
-rw-r--r-- | net-fs/autofs/files/autofs.rc9 | 16 | ||||
-rw-r--r-- | net-fs/autofs/files/digest-autofs-4.1.3-r4 | 8 |
8 files changed, 921 insertions, 21 deletions
diff --git a/net-fs/autofs/ChangeLog b/net-fs/autofs/ChangeLog index ddf187a228e4..5f1dfdb9211d 100644 --- a/net-fs/autofs/ChangeLog +++ b/net-fs/autofs/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-fs/autofs # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/ChangeLog,v 1.39 2005/02/05 12:46:30 griffon26 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/ChangeLog,v 1.40 2005/03/15 04:18:38 robbat2 Exp $ + +*autofs-4.1.3-r4 (14 Mar 2005) + + 14 Mar 2005; Robin H. Johnson <robbat2@gentoo.org> +files/autofs.rc10, + +files/autofs.rc11, +files/autofs.rc12, files/autofs.rc9, + +autofs-4.1.3-r4.ebuild: + Bug #82086 - totally revamp the init script, now supports all daemon + options. Also cleanup all usage of unsafe sub-shells. 05 Feb 2005; Maurice van der Pot <griffon26@gentoo.org> +files/autofs-4.1.3-signal-race-fix.patch, autofs-4.1.3-r3.ebuild: diff --git a/net-fs/autofs/Manifest b/net-fs/autofs/Manifest index 6298c0d97076..9e1f53b59faf 100644 --- a/net-fs/autofs/Manifest +++ b/net-fs/autofs/Manifest @@ -1,15 +1,13 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - MD5 e820df1a57ba682652efee940b0ac147 autofs-4.1.3-r2.ebuild 2928 MD5 9630b044705f7d7767adaed924e12819 autofs-4.0.0.ebuild 1928 MD5 6295dea1b85bae2ee4f821c93a203707 autofs-4.1.3.ebuild 1932 MD5 2ec9b6db2017b88545921a17e7fd5ab1 autofs-3.1.7-r6.ebuild 1783 +MD5 87669061f39a9db199cb21c834d81588 autofs-4.1.3-r4.ebuild 2955 MD5 44f4d9269d0d413a5705c63763d13b89 autofs-3.1.7-r3.ebuild 1285 MD5 3d3cf02251e5c203425b834ca9ab4089 autofs-4.1.3-r1.ebuild 2864 MD5 9b1633cf8ba801b528f62fbbd605ee92 autofs-3.1.7-r5.ebuild 1749 MD5 1157575439ed1bae4d2c801d6bd87995 autofs-4.1.3-r3.ebuild 2954 -MD5 1bcaab6d554c80c06cdfd3733086d234 ChangeLog 5999 +MD5 f3b3416f9027d8b143b5dd78b126a3bb ChangeLog 6319 MD5 3281a009cd789c5c937c9e6a3124e792 metadata.xml 287 MD5 517e323f25fec842b06d2fe2dd3fbe4a autofs-3.1.7-r4.ebuild 1735 MD5 a132f5883b92e2b509fa66e429f913ab files/autofs.confd 186 @@ -18,14 +16,18 @@ MD5 759f43aeed6787d6b6d7556d03afe782 files/auto.master 267 MD5 b7b301269f0796121d1f29c4a128b79e files/auto.net 1132 MD5 be9e796b14bbb9f659368203127602c4 files/autofs-4.1.3-signal-race-fix.patch 426 MD5 39ac8cc927dab754a7694abdb1a2cdc5 files/open_max.diff 408 +MD5 daf99a2ac1591fae34c3d792a7d63ce7 files/autofs.rc10 6372 +MD5 37cd03b2cacec429d9768f872ded1de5 files/autofs.rc11 7468 +MD5 d0be7aa0c9c3d43dd0c4cb8d17b15b4e files/autofs.rc12 7806 MD5 7fa23f910baa8aa00609bd74a60c8e34 files/autofs1.confd 137 MD5 2f74c237baee9004a019d3365ab04c0d files/digest-autofs-4.1.3-r1 586 MD5 f311a86fdf3a03702afac9cf4fd74528 files/digest-autofs-4.1.3-r2 660 MD5 4e3ad0d70f88a0cb691ea5442f95421f files/digest-autofs-4.1.3-r3 584 +MD5 4e3ad0d70f88a0cb691ea5442f95421f files/digest-autofs-4.1.3-r4 584 MD5 1b6efbe0072911c5c960a27e09a9d024 files/autofs.rc6 3717 MD5 4cc7219397b1bdb60da3f150bd7d9230 files/autofs.rc7 3624 MD5 539a3f843f501558cb01ca8c124e83f4 files/autofs.rc8 5186 -MD5 256cbf81075ea92d6fd45d915037f302 files/autofs.rc9 5598 +MD5 273ea7285f5301ab316475b3909f9abf files/autofs.rc9 5617 MD5 7b562ed7d75738124cadc9de83d4a335 files/digest-autofs-4.0.0 66 MD5 ba9378bfaf4e17d13789ac9a056ddb3b files/digest-autofs-4.1.3 65 MD5 552ad0cdacd4354b83dba94670ec0e99 files/autofs.confd9 799 @@ -38,10 +40,3 @@ MD5 ee656860c0682821d144556f674ca481 files/digest-autofs-3.1.7-r6 64 MD5 41de856a77a074078968ff244b863f88 files/automount.diff 322 MD5 77884391a3fbf365a88f5d2230b548d9 files/nisyp.patch 419 MD5 a872a3743192bbca4f78ecec7f74df03 files/ldap.diff 367 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.0 (GNU/Linux) - -iD8DBQFCBUP1I1lqEGTUzyQRAvARAJ9+n17XYPqPBNyotKbTcd5EPjY7XQCcDW0v -RU6RGNJaxgr5iquFADXoc6U= -=ZB+0 ------END PGP SIGNATURE----- diff --git a/net-fs/autofs/autofs-4.1.3-r4.ebuild b/net-fs/autofs/autofs-4.1.3-r4.ebuild new file mode 100644 index 000000000000..f26d103f68c2 --- /dev/null +++ b/net-fs/autofs/autofs-4.1.3-r4.ebuild @@ -0,0 +1,86 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/autofs-4.1.3-r4.ebuild,v 1.1 2005/03/15 04:18:38 robbat2 Exp $ + +inherit eutils + +IUSE="ldap" +DESCRIPTION="Kernel based automounter" +HOMEPAGE="http://www.linux-consulting.com/Amd_AutoFS/autofs.html" +SRC_URI_BASE="mirror://kernel/linux/daemons/${PN}/v4" +SRC_URI="${SRC_URI_BASE}/${P}.tar.bz2 + ${SRC_URI_BASE}/${P}-strict.patch + ${SRC_URI_BASE}/${P}-mtab_lock.patch + ${SRC_URI_BASE}/${P}-bad_chdir.patch + ${SRC_URI_BASE}/${P}-non_block_ping.patch + ${SRC_URI_BASE}/${P}-sock-leak-fix.patch + ${SRC_URI_BASE}/${P}-replicated_server_select.patch + mirror://gentoo/${P}-miscfixes.patch.gz" +DEPEND="virtual/libc + ldap? ( >=net-nds/openldap-2.0 )" +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~x86 ~alpha ~ppc ~sparc ~amd64 ~ia64 ~ppc64" + +src_unpack() { + unpack ${P}.tar.bz2 + PATCH_LIST="${P}-strict.patch ${P}-mtab_lock.patch ${P}-bad_chdir.patch ${P}-non_block_ping.patch ${P}-sock-leak-fix.patch ${P}-replicated_server_select.patch ${P}-miscfixes.patch.gz" + for i in ${PATCH_LIST}; do + EPATCH_OPTS="-p1 -d ${S}" epatch ${DISTDIR}/${i} + done + + # Upstream version of this patch is incorrect + epatch ${FILESDIR}/${P}-signal-race-fix.patch + + cd ${S} + autoconf || die "Autoconf failed" + + cd ${S}/daemon + sed -i 's/LIBS \= \-ldl/LIBS \= \-ldl \-lnsl \$\{LIBLDAP\}/' Makefile || die "LIBLDAP change failed" +} + +src_compile() { + local myconf + use ldap || myconf="--without-openldap" + + econf ${myconf} || die + sed -i -e '/^\(CFLAGS\|CXXFLAGS\|LDFLAGS\)[[:space:]]*=/d' Makefile.rules || die "Failed to remove (C|CXX|LD)FLAGS" + emake || die "make failed" +} + +src_install() { + into /usr + dosbin daemon/automount + exeinto /usr/lib/autofs + doexe modules/*.so + + dodoc COPYING COPYRIGHT NEWS README* TODO CHANGELOG CREDITS + cd ${S}/samples + docinto samples ; dodoc auto.misc auto.master + cd ${S}/man + sed -i 's:\/etc\/:\/etc\/autofs\/:g' *.8 *.5 *.in || die "Failed to update path in manpages" + doman auto.master.5 autofs.5 autofs.8 automount.8 + + dodir /etc/autofs /etc/init.d /etc/conf.d + insinto /etc/autofs ; doins ${FILESDIR}/auto.master + insinto /etc/autofs ; doins ${FILESDIR}/auto.misc + exeinto /etc/autofs ; doexe ${FILESDIR}/auto.net # chmod 755 is important! + + exeinto /etc/init.d ; newexe ${FILESDIR}/autofs.rc11 autofs + insinto /etc/conf.d ; newins ${FILESDIR}/autofs.confd9 autofs + if use ldap; then + cd ${S}/samples + docinto samples ; dodoc ldap* auto.master.ldap + insinto /etc/openldap/schema ; doins autofs.schema + exeinto /usr/lib/autofs ; doexe autofs-ldap-auto-master + fi +} + +pkg_postinst() { + einfo "Note: If you plan on using autofs for automounting" + einfo "remote NFS mounts without having the NFS daemon running" + einfo "please add portmap to your default run-level." + echo "" + einfo "Also the normal autofs status has been renamed stats" + einfo "as there is already a predefined Gentoo status" +} diff --git a/net-fs/autofs/files/autofs.rc10 b/net-fs/autofs/files/autofs.rc10 new file mode 100644 index 000000000000..9e6b167595e9 --- /dev/null +++ b/net-fs/autofs/files/autofs.rc10 @@ -0,0 +1,236 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs.rc10,v 1.1 2005/03/15 04:18:38 robbat2 Exp $ + +# rc file for automount using a Sun-style "master map". +# We first look for a local /etc/autofs/auto.master, then a YP +# map with that name + +DAEMON=/usr/sbin/automount + +depend() { + need localmount + use ypbind nfs slapd portmap net +} + +opts="start stop status stats reload restart" + +# +# Check for all maps that are to be loaded +# +function getschemes() +{ + awk '/^automount:/{ $1="" ; gsub("\\[.*\\]","") ; print $0 }' /etc/nsswitch.conf +} + +function getfilemounts() +{ + if [ -f /etc/autofs/auto.master ] ; then + sed -e '/^#/d' -e '/^$/d' < /etc/autofs/auto.master + fi +} + +function getnismounts() +{ + /usr/bin/ypcat -k ${nis_mapname} 2> /dev/null | sed -e '/^#/d' -e '/^$/d' +} + +function getldapmounts() +{ + if [ -x /usr/lib/autofs/autofs-ldap-auto-master ]; then + /usr/lib/autofs/autofs-ldap-auto-master \ + -m ${ldap_map_oc} -e ${ldap_entry_oc} \ + -n ${ldap_map_key} -k ${ldap_entry_key} \ + -v ${ldap_value} 2> /dev/null + fi +} + +function getrawmounts() +{ + for scheme in `getschemes` ; do + case "$scheme" in + files) + getfilemounts + ;; + nis*) + getnismounts + ;; + ldap*) + getldapmounts + ;; + esac + done +} + + +# +# 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() +{ + knownmaps=" " + getrawmounts | ( + while read dir map options + do + # These checks screen out duplicates and skip over directories + # where the map is '-'. + if [ ! -z "$dir" -a ! -z "$map" \ + -a x`echo "$map" | cut -c1` != 'x-' \ + -a "`echo "$knownmaps" | grep -w $dir/`" = "" ] + then + # If the options include a -t or --timeout parameter, then + # pull those particular options out. + # echo DAEMONOPTIONS OPTIONS $daemonoptions $options + allopts="$daemonoptions $options" + startupoptions= + + # there is no way to get all of these out in a single sed call that I'm aware of :-( + opt_timeout="$(echo ${allopts} | sed -n -e '/-t/s/.*--*t\(imeout\)*[[:space:]=]*\([0-9][0-9]*\).*$/--timeout \2/gp')" + opt_pidfile="$(echo ${allopts} | sed -n -e '/-p/s/.*--*p\(id-file\)*[[:space:]=]*\([^[:space:]]*\).*$/--pid-file \2/gp')" + opt_verbose="$(echo ${allopts} | sed -n -e '/-v/s/.*--*v\(erbose\)*.*$/--verbose/gp')" + opt_debug="$(echo ${allopts} | sed -n -e '/-d/s/.*--*d\(ebug\)*.*$/--debug/gp')" + opt_ghost="$(echo ${allopts} | sed -n -e '/-g/s/.*--*g\(host\)*.*$/--ghost/gp')" + + startupoptions="${opt_timeout} ${opt_pidfile} ${opt_verbose} ${opt_debug} ${opt_ghost}" + + + # Other option flags are intended for maps. + mapoptions="$(echo ${allopts} | sed \ + -e '/-t/{s/--*t\(imeout\)*[[:space:]=]*\([0-9][0-9]*\)//g }' \ + -e '/-p/{s/--*p\(id-file\)*[[:space:]=]*\([^[:space:]]*\)//g }' \ + -e '/-v/{s/--*v\(erbose\)*//g }' \ + -e '/-d/{s/--*d\(ebug\)*//g }' \ + -e '/-g/{s/--*g\(host\)*//g }' \ + -e 's/^[[:space:]]*//g' \ + -e 's/[[:space:]]*$//g')" + + # Break up the maptype and map, if the map type is specified + maptype="${map/:*}" + # Handle degenerate map specifiers + if [ "$maptype" = "$map" ] ; then + if [ -x "$map" ]; then + maptype="program" + elif [ -x "/etc/$map" ]; then + maptype="program" + map=`echo /etc/$map | sed 's^//^/^g'` + elif [ -f "$map" ]; then + maptype="file" + elif [ -f "/etc/$map" ]; then + maptype="file" + map=`echo /etc/$map | sed 's^//^/^g'` + elif [ "$map" = "hesiod" -o "$map" = "userhome" ] ; then + maptype="$map" + map= + elif [ "$map" = "multi" ] ; then + maptype="$map" + map= + else + maptype=yp + map=`basename $map | sed -e s/^auto_home/auto.home/ -e s/^auto_mnt/auto.mnt/` + fi + fi + map="${map#*:}" + + #echo STARTUPOPTIONS $startupoptions > /tmp/debug + #echo DIR $dir >> /tmp/debug + #echo MAPTYPE $maptype >> /tmp/debug + #echo MAP $map >> /tmp/debug + #echo MAPOPTIONS $mapoptions >> /tmp/debug + #echo LOCALOPTIONS $localoptions >> /tmp/debug + + echo "$DAEMON $startupoptions $dir $maptype $map $mapoptions $localoptions" | sed -e 's/ / /g' -e 's/ / /g' + + # echo ------------------------ + fi + knownmaps=" $dir/ $knownmaps" + done + ) +} + + +start() { + ebegin "Starting automounter" + # Check that maps exist + if [ -z "$(getmounts)" ]; then + eend 1 "No automount maps defined" + exit 1 + fi + # ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 || modprobe -q autofs + if [ $? -ne 0 ]; then + eend 1 "No autofs support available" + exit 1 + fi + # Now go + getmounts | while read cmd timeout time mnt rest + do + #FIXME: this works but it really sucks + if echo $timeout|grep -v -- '--timeout' >/dev/null ; then + rest="$time $mnt $rest" + mnt="$timeout" + time="" + timeout="" + fi + + echo -n " $mnt" + pidfile=/var/run/autofs`echo $mnt | sed 's/\//./g'`.pid + start-stop-daemon --start --pidfile $pidfile --quiet \ + --exec /usr/sbin/automount -- $timeout $time $mnt $rest + # + # Automount needs a '--pidfile' or '-p' option. + # For now we look for the pid ourself. + # + ps ax | grep "[0-9]:[0-9][0-9] /usr/sbin/automount $timeout $time \?$mnt" | ( + read pid rest + echo $pid > $pidfile + echo "$mnt $rest" >> $pidfile + ) + done + echo + eend $? +} + +stop() { + ebegin "Stopping automounter" + start-stop-daemon --stop --quiet --signal 12 --exec /usr/sbin/automount + eend $? +} + +stats() { + echo "Configured Mount Points:" + echo "------------------------" + getmounts + echo "" + echo "Active Mount Points:" + echo "--------------------" + ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( + while read pid tt stat time command; do echo $command; done + ) +} + +reload() { + echo "Reloading automounter: checking for changes ... " + TMP=/var/run/autofs.tmp + getmounts >$TMP + for i in /var/run/autofs.*.pid + do + pid=`head -n 1 $i 2>/dev/null` + [ "$pid" = "" ] && continue + command=`tail -n +2 $i` + if ! grep -q "^$command" $TMP + then + echo "Stopping automounter: $command" + kill -USR2 $pid + fi + done + rm -f $TMP + svc_start +} + +restart() { + svc_stop + svc_start +} diff --git a/net-fs/autofs/files/autofs.rc11 b/net-fs/autofs/files/autofs.rc11 new file mode 100644 index 000000000000..ad85f5bf0dad --- /dev/null +++ b/net-fs/autofs/files/autofs.rc11 @@ -0,0 +1,279 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs.rc11,v 1.1 2005/03/15 04:18:38 robbat2 Exp $ + +# rc file for automount using a Sun-style "master map". +# We first look for a local /etc/autofs/auto.master, then a YP +# map with that name + +DAEMON=/usr/sbin/automount + +depend() { + need localmount + use ypbind nfs slapd portmap net +} + +opts="start stop status stats reload restart" + +# this file is used to avoid the subshell-die problem +TMPSRC=/var/run/autofs.tmp + +# +# Check for all maps that are to be loaded +# +function getschemes() +{ + awk '/^automount:/{ $1="" ; gsub("\\[.*\\]","") ; print $0 }' /etc/nsswitch.conf +} + +function getfilemounts() +{ + if [ -f /etc/autofs/auto.master ] ; then + sed -e '/^#/d' -e '/^$/d' < /etc/autofs/auto.master + fi +} + +function getnismounts() +{ + /usr/bin/ypcat -k ${nis_mapname} 2> /dev/null | sed -e '/^#/d' -e '/^$/d' +} + +function getldapmounts() +{ + autofs_lam=/usr/lib/autofs/autofs-ldap-auto-master + if [ -f $autofs_lam -a -x $autofs_lam ]; then + ${autofs_lam} \ + -m ${ldap_map_oc} -e ${ldap_entry_oc} \ + -n ${ldap_map_key} -k ${ldap_entry_key} \ + -v ${ldap_value} 2> /dev/null + fi +} + +function getrawmounts() +{ + for scheme in `getschemes` ; do + case "$scheme" in + files) + getfilemounts + ;; + nis*) + getnismounts + ;; + ldap*) + getldapmounts + ;; + esac + done +} + + +# +# 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() +{ + knownmaps=" " + # seperate storage variable to avoid clobbering the other $TMPSRC + TMPSRC_mounts="$TMPSRC.mounts" + getrawmounts >$TMPSRC_mounts + while read dir map options + do + # These checks screen out duplicates and skip over directories + # where the map is '-'. + if [ ! -z "$dir" -a ! -z "$map" \ + -a "x${map:0:1}" != "x-" \ + -a "`echo "$knownmaps" | grep -w $dir/`" = "" ]; then + # If the options include a -t or --timeout parameter, then + # pull those particular options out. + # echo DAEMONOPTIONS OPTIONS $daemonoptions $options + startupoptions="" + opt_timeout="" + opt_pidfile="" + opt_verbose="" + opt_debug="" + opt_ghost="" + + # use getopt to parse all of it + #getopteval="$(getopt -q -o -t:p:vdg --long timeout:,pid-file:,verbose,debug,ghost -- "$daemonoptions $options") " + getopt_input="$daemonoptions $options" + getopt_eval="$(getopt -q -o -t:vdg --long timeout:,verbose,debug,ghost -- $getopt_input) " + eval set -- "${getopt_eval}" + while [ -n "$1" ]; do + #-p|--pid-file) opt_pidfile="$2" ; shift 2 ;; + case $1 in + -t|--timeout) opt_timeout="$2" ; shift 2 ;; + -v|--verbose) opt_verbose="--verbose" ; shift ;; + -d|--debug) opt_debug="--debug" ; shift ;; + -g|--ghost) opt_ghost="--ghost" ; shift ;; + --) shift ; break ;; + *) shift ;; # just ignore other params for now + esac + done + # build the parameters + [ -n "${opt_timeout}" ] && startupoptions="${startupoptions} --timeout ${opt_timeout}" + #[ -n "${opt_pidfile}" ] && startupoptions="${startupoptions} --pid-file ${opt_pidfile}" + startupoptions="${startupoptions} ${opt_ghost} ${opt_verbose} ${opt_debug}" + + # Other option flags are intended for maps. + # unfortuntely this can't be integrated with the above getopt(1) + mapoptions="$(echo $daemonoptions $options | sed \ + -e '/-t/{s/--*t\(imeout\)*[[:space:]=]*\([0-9][0-9]*\)//g }' \ + -e '/-v/{s/--*v\(erbose\)*//g }' \ + -e '/-d/{s/--*d\(ebug\)*//g }' \ + -e '/-g/{s/--*g\(host\)*//g }' \ + -e 's/^[[:space:]]*//g' \ + -e 's/[[:space:]]*$//g')" + #-e '/-p/{s/--*p\(id-file\)*[[:space:]=]*\([^[:space:]]*\)//g }' \ + + # Break up the maptype and map, if the map type is specified + maptype="${map/:*}" + # Handle degenerate map specifiers + if [ "$maptype" = "$map" ] ; then + if [ -x "$map" ]; then + maptype="program" + elif [ -x "/etc/$map" ]; then + maptype="program" + map="/etc/$map" + map="${map//\/\//\/}" # strip doubles + elif [ -f "$map" ]; then + maptype="file" + elif [ -f "/etc/$map" ]; then + maptype="file" + map="/etc/$map" + map="${map//\/\//\/}" # strip doubles + elif [ "$map" = "hesiod" -o "$map" = "userhome" ] ; then + maptype="$map" + map= + elif [ "$map" = "multi" ] ; then + maptype="$map" + map= + else + maptype=yp + map="${map/*\/}" # same as "basename $map" + map="${map/#auto_/auto.}" # echo $map | sed -e 's/^auto_home/auto.home/' -e 's/^auto_mnt/auto.mnt/' + fi + fi + map="${map#*:}" + + #echo >>/tmp/debug + #date >>/tmp/debug + #echo STARTUPOPTIONS $startupoptions >> /tmp/debug + #echo DIR $dir >> /tmp/debug + #echo MAPTYPE $maptype >> /tmp/debug + #echo MAP $map >> /tmp/debug + #echo MAPOPTIONS $mapoptions >> /tmp/debug + #echo LOCALOPTIONS $localoptions >> /tmp/debug + #echo OPTIONS $options >>/tmp/debug + #echo GETOPT_INPUT $getopt_input >>/tmp/debug + + [ -z "${startupoptions}" ] && startupoptions=" " # to make life easier later + # protect startupoptions with _X_ to use it later + cmdline="$DAEMON ${startupoptions// /_X_} $dir $maptype $map ${mapoptions} ${localoptions}" + # leave out the " so that white space gets compressed + echo ${cmdline} + + # echo ------------------------ + fi + knownmaps=" $dir/ $knownmaps" + done <$TMPSRC_mounts + rm -f $TMPSRC_mounts +} + + +start() { + ebegin "Starting automounter" + # ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 || modprobe -q autofs + if [ $? -ne 0 ]; then + eend 1 "No autofs support available" + return 1 + fi + + getmounts >$TMPSRC + + # Check that maps exist + if [ ! -s $TMPSRC ]; then + eend 1 "No automount maps defined" + return 1 + fi + + while read cmd startupopts mnt rest ; do + pidfile=/var/run/autofs${mnt//\//.}.pid + startupopts="$(echo ${startupopts//_X_/ } --pid-file ${pidfile} )" + bin="/usr/sbin/automount" + params="$(echo $startupopts $mnt $rest)" + + echo -n " $mnt" + #echo " $mnt ($params)" + + start-stop-daemon --start --pidfile $pidfile --quiet \ + --exec ${bin} -- ${params} + #ps ax | grep "[0-9]:[0-9][0-9] ${bin} ${params}" | ( + # read pid rest + # echo $pid > $pidfile + # echo "$mnt $rest" >> $pidfile + #) + if [ $? -ne 0 ]; then + eerror "Failure on $mnt" + else + echo "${params}" >> $pidfile + fi + done < $TMPSRC + # clean up + rm -f $TMPSRC + + echo + + eend $? +} + +stop() { + ebegin "Stopping automounter" + start-stop-daemon --stop --quiet --signal USR2 --exec /usr/sbin/automount + eend $? +} + +stats() { + echo "Configured Mount Points:" + echo "------------------------" + getmounts >$TMPSRC + while read cmd startupopts mnt rest ; do + pidfile=/var/run/autofs${mnt//\//.}.pid + startupopts="$(echo ${startupopts//_X_/ } --pid-file ${pidfile} )" + params="$(echo $startupopts $mnt $rest)" + echo $cmd $params + done <$TMPSRC + rm -f $TMPSRC + echo "" + echo "Active Mount Points:" + echo "--------------------" + ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( + while read pid tt stat time command; do echo $command; done + ) +} + +reload() { + echo "Reloading automounter: checking for changes ... " + getmounts >$TMPSRC + for i in /var/run/autofs.*.pid + do + pid=`head -n 1 $i 2>/dev/null` + [ -z "$pid" ] && continue + command=`tail -n +2 $i` + if ! grep -q "^$command" $TMPSRC + then + echo "Stopping automounter: $command" + kill -USR2 $pid + fi + done + rm -f $TMPSRC + svc_start +} + +restart() { + svc_stop + svc_start +} diff --git a/net-fs/autofs/files/autofs.rc12 b/net-fs/autofs/files/autofs.rc12 new file mode 100644 index 000000000000..9fdfc20bdd98 --- /dev/null +++ b/net-fs/autofs/files/autofs.rc12 @@ -0,0 +1,288 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs.rc12,v 1.1 2005/03/15 04:18:38 robbat2 Exp $ + +# rc file for automount using a Sun-style "master map". +# We first look for a local /etc/autofs/auto.master, then a YP +# map with that name + +DAEMON=/usr/sbin/automount +SYSCONFDIR=/etc/autofs + +depend() { + need localmount + use ypbind nfs slapd portmap net +} + +opts="start stop status stats reload restart" + +# this file is used to avoid the subshell-die problem +TMPSRC=/var/run/autofs.tmp + +# +# Check for all maps that are to be loaded +# +function getschemes() { + schemes="$(awk '/^automount:/{ $1="" ; gsub("\\[.*\\]","") ; print $0 }' /etc/nsswitch.conf)" + # have a default entry + [ -z "$schemes" ] && echo 'files' || echo $schemes +} + +function getfilemounts() { + if [ -f /etc/autofs/auto.master ] ; then + sed -e '/^#/d' -e '/^$/d' < /etc/autofs/auto.master + fi +} + +function catnismap() { + [ -z "$1" ] && map="auto_master" || map="$1" + /usr/bin/ypcat -k ${map} 2> /dev/null | sed -e '/^#/d' -e '/^$/d' +} + +function getnismounts() { + YPMAP="$(catnismap auto.master)" + if [ -z "$YPMAP" ]; then + catnismap + else + catnismap auto.master + fi +} + +function getldapmounts() { + autofs_lam=/usr/lib/autofs/autofs-ldap-auto-master + if [ -f $autofs_lam -a -x $autofs_lam ]; then + ${autofs_lam} \ + -m ${ldap_map_oc} -e ${ldap_entry_oc} \ + -n ${ldap_map_key} -k ${ldap_entry_key} \ + -v ${ldap_value} 2> /dev/null + fi +} + +function getrawmounts() +{ + for scheme in `getschemes` ; do + case "$scheme" in + files) + getfilemounts + ;; + nis*) + getnismounts + ;; + ldap*) + getldapmounts + ;; + esac + done +} + + +# +# 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() +{ + knownmaps=" " + # seperate storage variable to avoid clobbering the other $TMPSRC + TMPSRC_mounts="$TMPSRC.mounts" + getrawmounts >$TMPSRC_mounts + while read dir map options + do + # These checks screen out duplicates and skip over directories + # where the map is '-'. + if [ ! -z "$dir" -a ! -z "$map" \ + -a "x${map:0:1}" != "x-" \ + -a "`echo "$knownmaps" | grep -w $dir/`" = "" ]; then + # If the options include a -t or --timeout parameter, then + # pull those particular options out. + # echo DAEMONOPTIONS OPTIONS $daemonoptions $options + startupoptions="" + opt_timeout="" + opt_pidfile="" + opt_verbose="" + opt_debug="" + opt_ghost="" + + # use getopt to parse all of it + #getopteval="$(getopt -q -o -t:p:vdg --long timeout:,pid-file:,verbose,debug,ghost -- "$daemonoptions $options") " + getopt_input="$daemonoptions $options" + getopt_eval="$(getopt -q -o -t:vdg --long timeout:,verbose,debug,ghost -- $getopt_input) " + eval set -- "${getopt_eval}" + while [ -n "$1" ]; do + #-p|--pid-file) opt_pidfile="$2" ; shift 2 ;; + case $1 in + -t|--timeout) opt_timeout="$2" ; shift 2 ;; + -v|--verbose) opt_verbose="--verbose" ; shift ;; + -d|--debug) opt_debug="--debug" ; shift ;; + -g|--ghost) opt_ghost="--ghost" ; shift ;; + --) shift ; break ;; + *) shift ;; # just ignore other params for now + esac + done + # build the parameters + [ -n "${opt_timeout}" ] && startupoptions="${startupoptions} --timeout ${opt_timeout}" + #[ -n "${opt_pidfile}" ] && startupoptions="${startupoptions} --pid-file ${opt_pidfile}" + startupoptions="${startupoptions} ${opt_ghost} ${opt_verbose} ${opt_debug}" + + # Other option flags are intended for maps. + # unfortuntely this can't be integrated with the above getopt(1) + mapoptions="$(echo $daemonoptions $options | sed \ + -e '/-t/{s/--*t\(imeout\)*[[:space:]=]*\([0-9][0-9]*\)//g }' \ + -e '/-v/{s/--*v\(erbose\)*//g }' \ + -e '/-d/{s/--*d\(ebug\)*//g }' \ + -e '/-g/{s/--*g\(host\)*//g }' \ + -e 's/^[[:space:]]*//g' \ + -e 's/[[:space:]]*$//g')" + #-e '/-p/{s/--*p\(id-file\)*[[:space:]=]*\([^[:space:]]*\)//g }' \ + + # Break up the maptype and map, if the map type is specified + maptype="${map/:*}" + # Handle degenerate map specifiers + if [ "$maptype" = "$map" ] ; then + if [ -x "$map" ]; then + maptype="program" + elif [ -x "/etc/$map" ]; then + maptype="program" + map="/etc/$map" + map="${map//\/\//\/}" # strip doubles + elif [ -f "$map" ]; then + maptype="file" + elif [ -f "/etc/$map" ]; then + maptype="file" + map="/etc/$map" + map="${map//\/\//\/}" # strip doubles + elif [ "$map" = "hesiod" -o "$map" = "userhome" ] ; then + maptype="$map" + map= + elif [ "$map" = "multi" ] ; then + maptype="$map" + map= + else + maptype=yp + map="${map/*\/}" # same as "basename $map" + map="${map/#auto_/auto.}" # echo $map | sed -e 's/^auto_home/auto.home/' -e 's/^auto_mnt/auto.mnt/' + fi + fi + map="${map#*:}" + + #echo >>/tmp/debug + #date >>/tmp/debug + #echo STARTUPOPTIONS $startupoptions >> /tmp/debug + #echo DIR $dir >> /tmp/debug + #echo MAPTYPE $maptype >> /tmp/debug + #echo MAP $map >> /tmp/debug + #echo MAPOPTIONS $mapoptions >> /tmp/debug + #echo LOCALOPTIONS $localoptions >> /tmp/debug + #echo OPTIONS $options >>/tmp/debug + #echo GETOPT_INPUT $getopt_input >>/tmp/debug + + [ -z "${startupoptions}" ] && startupoptions=" " # to make life easier later + # protect startupoptions with _X_ to use it later + cmdline="$DAEMON ${startupoptions// /_X_} $dir $maptype $map ${mapoptions} ${localoptions}" + # leave out the " so that white space gets compressed + echo ${cmdline} + + # echo ------------------------ + fi + knownmaps=" $dir/ $knownmaps" + done <$TMPSRC_mounts + rm -f $TMPSRC_mounts +} + + +start() { + ebegin "Starting automounter" + # ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 || modprobe -q autofs + if [ $? -ne 0 ]; then + eend 1 "No autofs support available" + return 1 + fi + + getmounts >$TMPSRC + + # Check that maps exist + if [ ! -s $TMPSRC ]; then + eend 1 "No automount maps defined" + return 1 + fi + + while read cmd startupopts mnt rest ; do + pidfile=/var/run/autofs${mnt//\//.}.pid + startupopts="$(echo ${startupopts//_X_/ } --pid-file ${pidfile} )" + bin="/usr/sbin/automount" + params="$(echo $startupopts $mnt $rest)" + + echo -n " $mnt" + #echo " $mnt ($params)" + + start-stop-daemon --start --pidfile $pidfile --quiet \ + --exec ${bin} -- ${params} + #ps ax | grep "[0-9]:[0-9][0-9] ${bin} ${params}" | ( + # read pid rest + # echo $pid > $pidfile + # echo "$mnt $rest" >> $pidfile + #) + if [ $? -ne 0 ]; then + eerror "Failure on $mnt" + else + echo "${params}" >> $pidfile + fi + done < $TMPSRC + # clean up + rm -f $TMPSRC + + echo + + eend $? +} + +stop() { + ebegin "Stopping automounter" + start-stop-daemon --stop --quiet --signal USR2 --exec /usr/sbin/automount + eend $? +} + +stats() { + echo "Configured Mount Points:" + echo "------------------------" + getmounts >$TMPSRC + while read cmd startupopts mnt rest ; do + pidfile=/var/run/autofs${mnt//\//.}.pid + startupopts="$(echo ${startupopts//_X_/ } --pid-file ${pidfile} )" + params="$(echo $startupopts $mnt $rest)" + echo $cmd $params + done <$TMPSRC + rm -f $TMPSRC + echo "" + echo "Active Mount Points:" + echo "--------------------" + ps ax|grep "[0-9]:[0-9][0-9] /usr/sbin/automount " | ( + while read pid tt stat time command; do echo $command; done + ) +} + +reload() { + echo "Reloading automounter: checking for changes ... " + getmounts >$TMPSRC + for i in /var/run/autofs.*.pid + do + pid=`head -n 1 $i 2>/dev/null` + [ -z "$pid" ] && continue + command=`tail -n +2 $i` + if ! grep -q "^$command" $TMPSRC + then + echo "Stopping automounter: $command" + kill -USR2 $pid + fi + done + rm -f $TMPSRC + svc_start +} + +restart() { + svc_stop + svc_start +} diff --git a/net-fs/autofs/files/autofs.rc9 b/net-fs/autofs/files/autofs.rc9 index 93ccfed042c2..837138ad26b5 100644 --- a/net-fs/autofs/files/autofs.rc9 +++ b/net-fs/autofs/files/autofs.rc9 @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs.rc9,v 1.3 2004/12/16 23:42:57 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs.rc9,v 1.4 2005/03/15 04:18:38 robbat2 Exp $ # rc file for automount using a Sun-style "master map". # We first look for a local /etc/autofs/auto.master, then a YP @@ -11,7 +11,7 @@ DAEMON=/usr/sbin/automount depend() { need localmount - use ypbind nfs slapd portmap + use ypbind nfs slapd portmap net } opts="start stop status stats reload restart" @@ -138,17 +138,17 @@ function getmounts() start() { ebegin "Starting automounter" - # ensure autofs support is loaded - grep -q autofs /proc/filesystems || modprobe -q autofs autofs4 - if [ $? -ne 0 ]; then - eend 1 "No autofs support available" - exit 1 - fi # Check that maps exist if [ -z "$(getmounts)" ]; then eend 1 "No automount maps defined" exit 1 fi + # ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 || modprobe -q autofs + if [ $? -ne 0 ]; then + eend 1 "No autofs support available" + exit 1 + fi # Now go getmounts | while read cmd timeout time mnt rest do diff --git a/net-fs/autofs/files/digest-autofs-4.1.3-r4 b/net-fs/autofs/files/digest-autofs-4.1.3-r4 new file mode 100644 index 000000000000..e7bd1851d65d --- /dev/null +++ b/net-fs/autofs/files/digest-autofs-4.1.3-r4 @@ -0,0 +1,8 @@ +MD5 f43a09e94c4bd512ec58ac06e9d42c60 autofs-4.1.3.tar.bz2 125234 +MD5 d408ddcd5dafca8d2907b788f93b225c autofs-4.1.3-strict.patch 1626 +MD5 f2e7950dab204719162be84b63857abc autofs-4.1.3-mtab_lock.patch 551 +MD5 9efa8126decb509011646d4a4ed0779f autofs-4.1.3-bad_chdir.patch 6343 +MD5 e404ec690f3ef118ade6f0e605228258 autofs-4.1.3-non_block_ping.patch 7934 +MD5 14681387a1fc5229c2c73f593334071b autofs-4.1.3-sock-leak-fix.patch 1236 +MD5 bc536e7fe6e3c79f9b66a4254bf0ad43 autofs-4.1.3-replicated_server_select.patch 962 +MD5 5d2cb735d77cd397d3de600bf3e321e6 autofs-4.1.3-miscfixes.patch.gz 3058 |