diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-03-25 12:30:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-03-25 12:30:52 +0000 |
commit | 3fdf40c9b495697d51acd8c3540e7da6f81e632d (patch) | |
tree | 05234e75c4b733ea154863123c9c356555654026 /net-fs | |
parent | Stable on ppc wrt bug #168792. (diff) | |
download | gentoo-2-3fdf40c9b495697d51acd8c3540e7da6f81e632d.tar.gz gentoo-2-3fdf40c9b495697d51acd8c3540e7da6f81e632d.tar.bz2 gentoo-2-3fdf40c9b495697d51acd8c3540e7da6f81e632d.zip |
Split init.d scripts up so client/server configurations are handled properly #101624 by Tim Hobbs. Special thanks to Daniel Burr and Thomas Bettler.
(Portage version: 2.1.2.2)
Diffstat (limited to 'net-fs')
-rw-r--r-- | net-fs/nfs-utils/ChangeLog | 11 | ||||
-rw-r--r-- | net-fs/nfs-utils/files/digest-nfs-utils-1.0.12-r2 | 3 | ||||
-rw-r--r-- | net-fs/nfs-utils/files/nfs.confd | 21 | ||||
-rwxr-xr-x | net-fs/nfs-utils/files/nfs.initd | 149 | ||||
-rwxr-xr-x | net-fs/nfs-utils/files/nfsmount.initd | 28 | ||||
-rwxr-xr-x | net-fs/nfs-utils/files/rpc.gssd.initd | 42 | ||||
-rwxr-xr-x | net-fs/nfs-utils/files/rpc.idmapd.initd | 65 | ||||
-rwxr-xr-x | net-fs/nfs-utils/files/rpc.statd.initd | 35 | ||||
-rw-r--r-- | net-fs/nfs-utils/nfs-utils-1.0.12-r2.ebuild | 110 |
9 files changed, 454 insertions, 10 deletions
diff --git a/net-fs/nfs-utils/ChangeLog b/net-fs/nfs-utils/ChangeLog index f7d903a7f3a0..50f69c9283af 100644 --- a/net-fs/nfs-utils/ChangeLog +++ b/net-fs/nfs-utils/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-fs/nfs-utils # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.93 2007/03/25 11:34:15 dertobi123 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.94 2007/03/25 12:30:52 vapier Exp $ + +*nfs-utils-1.0.12-r2 (25 Mar 2007) + + 25 Mar 2007; Mike Frysinger <vapier@gentoo.org> files/nfs.confd, + +files/nfs.initd, +files/nfsmount.initd, +files/rpc.gssd.initd, + +files/rpc.idmapd.initd, +files/rpc.statd.initd, + +nfs-utils-1.0.12-r2.ebuild: + Split init.d scripts up so client/server configurations are handled properly + #101624 by Tim Hobbs. Special thanks to Daniel Burr and Thomas Bettler. 25 Mar 2007; Tobias Scherbaum <dertobi123@gentoo.org> nfs-utils-1.0.12.ebuild: diff --git a/net-fs/nfs-utils/files/digest-nfs-utils-1.0.12-r2 b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.12-r2 new file mode 100644 index 000000000000..bdb8c3cf47a5 --- /dev/null +++ b/net-fs/nfs-utils/files/digest-nfs-utils-1.0.12-r2 @@ -0,0 +1,3 @@ +MD5 acf3656cec3872deb597aa7ac13f3c3a nfs-utils-1.0.12.tar.gz 778576 +RMD160 a00dbdae386acf3f969714a1571749182c5a19a8 nfs-utils-1.0.12.tar.gz 778576 +SHA256 67d81a53d84777c733ff8a5cf5f3eed9ecda17fb9f949bc65727c1a3427af8ac nfs-utils-1.0.12.tar.gz 778576 diff --git a/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd index 2d26adc46f94..98a143a654d1 100644 --- a/net-fs/nfs-utils/files/nfs.confd +++ b/net-fs/nfs-utils/files/nfs.confd @@ -4,24 +4,27 @@ # please see /etc/sysctl.conf # Number of servers to be started up by default -RPCNFSDCOUNT=8 +OPTS_RPC_NFSD="8" # Options to pass to rpc.mountd -# ex. RPCMOUNTDOPTS="-p 32767 -RPCMOUNTDOPTS="" +# ex. OPTS_RPC_MOUNTD="-p 32767" +OPTS_RPC_MOUNTD="" # Options to pass to rpc.statd -# ex. RPCSTATDOPTS="-p 32765 -o 32766" -RPCSTATDOPTS="" +# ex. OPTS_RPC_STATD="-p 32765 -o 32766" +OPTS_RPC_STATD="" # Options to pass to rpc.idmapd -RPCIDMAPDOPTS="" +OPTS_RPC_IDMAPD="" # Options to pass to rpc.gssd -RPCGSSDOPTS="" +OPTS_RPC_GSSD="" # Options to pass to rpc.svcgssd -RPCSVCGSSDOPTS="" +OPTS_RPC_SVCGSSD="" + +# Options to pass to rpc.rquotad (requires sys-fs/quota) +OPTS_RPC_RQUOTAD="" # Timeout (in seconds) for exportfs -EXPORTFSTIMEOUT=30 +EXPORTFS_TIMEOUT=30 diff --git a/net-fs/nfs-utils/files/nfs.initd b/net-fs/nfs-utils/files/nfs.initd new file mode 100755 index 000000000000..bb9ea0650440 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs.initd @@ -0,0 +1,149 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfs.initd,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +#--------------------------------------------------------------------------- +# This script starts/stops the following +# rpc.nfsd +# rpc.mountd +#--------------------------------------------------------------------------- + +# NB: Config is in /etc/conf.d/nfs + +opts="reload" + +# This variable is used for controlling whether or not to run exportfs -ua; +# see stop() for more information +restarting=no + +# The binary locations +exportfs=/usr/sbin/exportfs + mountd=/usr/sbin/rpc.mountd + nfsd=/usr/sbin/rpc.nfsd + +depend() { + local myneed="" myuse="" + local nfs_mounts=$(awk '!/^[[:space:]]*#/ && $3=="nfs4" { print $0 }' /etc/fstab) + if [ -n "${nfs_mounts}" ] ; then + myneed="rpc.idmapd rpc.gssd" + else + myuse="rpc.idmapd rpc.gssd" + fi + use ypbind net rpc.rquotad ${myuse} + need portmap rpc.statd ${myneed} + after quota +} + +mkdir_nfsdirs() { + local d + for d in /var/lib/nfs/{rpc_pipefs,v4recovery,v4root} ; do + [ ! -d "${d}" ] && mkdir -p "${d}" + done +} + +waitfor_exportfs() { + local pid=$1 + ( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 $pid &>/dev/null ) & + wait $1 +} + +start_it() { + ebegin "Starting NFS $1" + shift + "$@" + eend $? + ((ret+=$?)) +} +start() { + # Make sure nfs support is loaded in the kernel #64709 + if [ -e /proc/modules ] && ! grep -qs nfsd /proc/filesystems ; then + modprobe nfsd &> /dev/null + fi + + # This is the new "kernel 2.6 way" to handle the exports file + if grep -qs nfsd /proc/filesystems ; then + if ! grep -qs "nfsd /proc/fs/nfs" /proc/mounts ; then + ebegin "Mounting nfsd filesystem in /proc" + mount -t nfsd nfsd /proc/fs/nfs + eend $? + fi + fi + # now that nfsd is mounted inside /proc, we can safely start mountd later + + mkdir_nfsdirs + + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + if grep -qs '^[[:space:]]*/' /etc/exports ; then + ebegin "Exporting NFS directories" + ${exportfs} -r & + waitfor_exportfs $! + eend $? + fi + + local ret=0 + start_it daemon ${nfsd} ${OPTS_RPC_NFSD} + start_it mountd ${mountd} ${OPTS_RPC_MOUNTD} + return ${ret} +} + +stop() { + local ret=0 + + # Don't check NFSSERVER variable since it might have changed, + # instead use --oknodo to smooth things over + ebegin "Stopping NFS mountd" + start-stop-daemon --stop --quiet --oknodo --exec ${mountd} + eend $? + ((ret+=$?)) + + # nfsd sets its process name to [nfsd] so don't look for $nfsd + ebegin "Stopping NFS daemon" + start-stop-daemon --stop --quiet --oknodo --name nfsd --user root --signal 2 + eend $? + ((ret+=$?)) + + # When restarting the NFS server, running "exportfs -ua" probably + # isn't what the user wants. Running it causes all entries listed + # in xtab to be removed from the kernel export tables, and the + # xtab file is cleared. This effectively shuts down all NFS + # activity, leaving all clients holding stale NFS filehandles, + # *even* when the NFS server has restarted. + # + # That's what you would want if you were shutting down the NFS + # server for good, or for a long period of time, but not when the + # NFS server will be running again in short order. In this case, + # then "exportfs -r" will reread the xtab, and all the current + # clients will be able to resume NFS activity, *without* needing + # to umount/(re)mount the filesystem. + if [ "${restarting}" = no ] ; then + ebegin "Unexporting NFS directories" + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # shutdown process can continue. + ${exportfs} -ua & + waitfor_exportfs $! + eend $? + fi + + return ${ret} +} + +reload() { + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + ebegin "Reloading /etc/exports" + ${exportfs} -r 1>&2 & + waitfor_exportfs $! + eend $? +} + +restart() { + # See long comment in stop() regarding "restarting" and exportfs -ua + restarting=yes + svc_stop + svc_start +} diff --git a/net-fs/nfs-utils/files/nfsmount.initd b/net-fs/nfs-utils/files/nfsmount.initd new file mode 100755 index 000000000000..3a5753d41a09 --- /dev/null +++ b/net-fs/nfs-utils/files/nfsmount.initd @@ -0,0 +1,28 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsmount.initd,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +depend() { + local myneed="" myuse="" + local nfs_mounts=$(awk '!/^[[:space:]]*#/ && $3=="nfs4" { print $0 }' /etc/fstab) + if [ -n "${nfs_mounts}" ] ; then + myneed="rpc.idmapd rpc.gssd" + else + myuse="rpc.idmapd rpc.gssd" + fi + need net portmap rpc.statd ${myneed} + use ypbind ${myuse} +} + +start() { + ebegin "Mounting NFS filesystems" + mount -a -t nfs,nfs4 + eend $? +} + +stop() { + ebegin "Unmounting NFS filesystems" + umount -a -t nfs,nfs4 + eend $? +} diff --git a/net-fs/nfs-utils/files/rpc.gssd.initd b/net-fs/nfs-utils/files/rpc.gssd.initd new file mode 100755 index 000000000000..bafe1bc773c3 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.gssd.initd @@ -0,0 +1,42 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.gssd.initd,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && source /etc/conf.d/nfs + + gssd=/usr/sbin/rpc.gssd +svcgssd=/usr/sbin/rpc.svcgssd + +depend() { + use ypbind net + need portmap + after quota +} + +start_it() { + ebegin "Starting $1" + shift + "$@" + eend $? + ((ret+=$?)) +} +start() { + local ret=0 + start_it gssd ${gssd} ${OPTS_RPC_GSSD} + start_it svcgssd ${svcgssd} ${OPTS_RPC_SVCGSSD} + return ${ret} +} + +stop_it() { + ebegin "Stopping $1" + start-stop-daemon --stop --quiet --exec $2 + eend $? + ((ret+=$?)) +} +stop() { + local ret=0 + stop_it gssd ${gssd} + stop_it svcgssd ${svcgssd} + return ${ret} +} diff --git a/net-fs/nfs-utils/files/rpc.idmapd.initd b/net-fs/nfs-utils/files/rpc.idmapd.initd new file mode 100755 index 000000000000..2f8a92bf32b1 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.idmapd.initd @@ -0,0 +1,65 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.idmapd.initd,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && source /etc/conf.d/nfs + +rpc_bin=/usr/sbin/rpc.idmapd + +# since baselayout doesn't export this sort of information, we need +# to hack around it ... this is to keep from needlessly unmounting/mounting +# rpc_pipefs during a restart ... +restarting="no" + +depend() { + use ypbind net + need portmap + after quota +} + +mount_pipefs() { + if grep -qs rpc_pipefs /proc/filesystems ; then + if ! grep -qs "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts ; then + ebegin "Mounting RPC pipefs" + mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs + eend $? + fi + fi +} + +umount_pipefs() { + [ "${restarting}" = "yes" ] && return 0 + if grep -qs "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts ; then + ebegin "Unmounting RPC pipefs" + umount /var/lib/nfs/rpc_pipefs + eend $? + fi +} + +start() { + mount_pipefs + + ebegin "Starting idmapd" + ${rpc_bin} ${OPTS_RPC_IDMAPD} + eend $? +} + +stop() { + local ret + + ebegin "Stopping idmapd" + start-stop-daemon --stop --quiet --exec ${rpc_bin} + ret=$? + eend ${ret} + + umount_pipefs + + return ${ret} +} + +restart() { + restarting="yes" + svc_stop + svc_start +} diff --git a/net-fs/nfs-utils/files/rpc.statd.initd b/net-fs/nfs-utils/files/rpc.statd.initd new file mode 100755 index 000000000000..0dac37b80478 --- /dev/null +++ b/net-fs/nfs-utils/files/rpc.statd.initd @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.statd.initd,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && source /etc/conf.d/nfs + +rpc_bin=/sbin/rpc.statd +rpc_pid=/var/run/rpc.statd.pid + +depend() { + use ypbind net + need portmap + after quota +} + +is_running() { + # Don't start rpc.statd if already started by someone else ... + # Don't try and kill it if it's already dead ... + killall -0 rpc.statd 2>/dev/null +} + +start() { + is_running && return 0 + ebegin "Starting NFS statd" + start-stop-daemon --start --quiet --exec ${rpc_bin} -- ${OPTS_RPC_STATD} + eend $? +} + +stop() { + is_running || return 1 + ebegin "Stopping NFS statd" + start-stop-daemon --stop --quiet --exec ${rpc_bin} --pidfile /var/run/rpc.statd.pid + eend $? +} diff --git a/net-fs/nfs-utils/nfs-utils-1.0.12-r2.ebuild b/net-fs/nfs-utils/nfs-utils-1.0.12-r2.ebuild new file mode 100644 index 000000000000..f962c2c01e05 --- /dev/null +++ b/net-fs/nfs-utils/nfs-utils-1.0.12-r2.ebuild @@ -0,0 +1,110 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.0.12-r2.ebuild,v 1.1 2007/03/25 12:30:52 vapier Exp $ + +inherit eutils flag-o-matic multilib + +DESCRIPTION="NFS client and server daemons" +HOMEPAGE="http://nfs.sourceforge.net/" +SRC_URI="mirror://sourceforge/nfs/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="nonfsv4 tcpd kerberos" + +# kth-krb doesn't provide the right include +# files, and nfs-utils doesn't build against heimdal either, +# so don't depend on virtual/krb. +# (04 Feb 2005 agriffis) +RDEPEND="tcpd? ( sys-apps/tcp-wrappers ) + >=net-nds/portmap-5b-r6 + !nonfsv4? ( + >=dev-libs/libevent-1.0b + >=net-libs/libnfsidmap-0.16 + ) + kerberos? ( + net-libs/librpcsecgss + app-crypt/mit-krb5 + )" +DEPEND="${RDEPEND} + >=sys-apps/portage-2.0.51" + +src_unpack() { + unpack ${P}.tar.gz + cd "${S}" + epatch "${FILESDIR}"/${P}-mountd-memleak.patch #172014 + #epatch "${DISTDIR}"/nfs-utils-${PV}-CITI_NFS4_ALL-1.dif +} + +src_compile() { + econf \ + --mandir=/usr/share/man \ + --with-statedir=/var/lib/nfs \ + --disable-rquotad \ + --enable-nfsv3 \ + --enable-secure-statd \ + $(use_with tcpd tcp-wrappers) \ + $(use_enable !nonfsv4 nfsv4) \ + $(use_enable kerberos gss) \ + || die "Configure failed" + + emake || die "Failed to compile" +} + +src_install() { + emake DESTDIR="${D}" install || die + + # Don't overwrite existing xtab/etab, install the original + # versions somewhere safe... more info in pkg_postinst + dodir /usr/lib/nfs + keepdir /var/lib/nfs/{sm,sm.bak} + mv "${D}"/var/lib/nfs/* "${D}"/usr/lib/nfs + keepdir /var/lib/nfs + + # Install some client-side binaries in /sbin + dodir /sbin + mv "${D}"/usr/sbin/rpc.{lockd,statd} "${D}"/sbin/ || die + + dodoc ChangeLog README + docinto linux-nfs ; dodoc linux-nfs/* + + insinto /etc + doins "${FILESDIR}"/exports + + local f + for f in nfs nfsmount rpc.{gssd,idmapd,statd} ; do + newinitd "${FILESDIR}"/${f}.initd ${f} || die "doinitd ${f}" + done + newconfd "${FILESDIR}"/nfs.confd nfs + + if use !nonfsv4 ; then + doins utils/idmapd/idmapd.conf + for f in rpc.gssd rpc.idmapd ; do + newinitd "${FILESDIR}"/${f}.initd ${f} || die "doinitd ${f}" + done + fi + + # uClibc doesn't provide rpcgen like glibc, so lets steal it from nfs-utils + if ! use elibc_glibc ; then + dobin tools/rpcgen/rpcgen || die "rpcgen" + newdoc tools/rpcgen/README README.rpcgen + fi +} + +pkg_preinst() { + [[ -s ${ROOT}/etc/exports ]] && rm -f "${D}"/etc/exports +} + +pkg_postinst() { + # Install default xtab and friends if there's none existing. + # In src_install we put them in /usr/lib/nfs for safe-keeping, but + # the daemons actually use the files in /var/lib/nfs. This fixes + # bug 30486 + local f + for f in "${ROOT}"/usr/$(get_libdir)/nfs/*; do + [[ -e ${ROOT}/var/lib/nfs/${f##*/} ]] && continue + einfo "Copying default ${f##*/} from /usr/$(get_libdir)/nfs to /var/lib/nfs" + cp -pPR "${f}" "${ROOT}"/var/lib/nfs/ + done +} |