Commit 0539ae2c authored by Sören Tempel's avatar Sören Tempel Committed by Leonardo Arena

main/nfs-utils: update OpenRC services from Gentoo

parent a620b1fb
......@@ -3,7 +3,7 @@
pkgname=nfs-utils
pkgver=2.1.1
_basever=$pkgver
pkgrel=0
pkgrel=1
pkgdesc="kernel-mode NFS"
url="http://nfs.sourceforge.net/"
arch="all"
......@@ -23,6 +23,7 @@ source="http://downloads.sourceforge.net/nfs/$pkgname-$_basever.tar.bz2
nfs.initd
nfsmount.initd
nfsmount.confd
rpc.gssd.initd
rpc.idmapd.initd
rpc.pipefs.initd
......@@ -30,6 +31,8 @@ source="http://downloads.sourceforge.net/nfs/$pkgname-$_basever.tar.bz2
rpc.svcgssd.initd
nfs.confd
nfs.exports
nfsclient.initd
nfsclient.confd
"
builddir="$srcdir/$pkgname-$_basever"
......@@ -61,33 +64,38 @@ build() {
package() {
cd $builddir
make -j1 DESTDIR="$pkgdir" install
install -Dm644 "$srcdir"/nfs.exports "$pkgdir"/etc/exports
local i=
for i in nfs rpc.pipefs rpc.svcgssd nfsmount rpc.idmapd rpc.gssd \
rpc.statd; do
install -m755 -D "$srcdir"/$i.initd "$pkgdir"/etc/init.d/$i
local file=
for file in $source; do
case "${file}" in
*.confd) install -Dm644 "$srcdir"/"$file" \
"$pkgdir"/etc/conf.d/${file%.*} ;;
*.initd) install -Dm755 "$srcdir"/"$file" \
"$pkgdir"/etc/init.d/${file%.*} ;;
esac
done
install -m644 -D "$srcdir"/nfs.confd "$pkgdir"/etc/conf.d/nfs
install -m644 -D "$srcdir"/nfs.exports "$pkgdir"/etc/exports
}
rpcgen() {
pkgdesc="Remote Procedure Call (RPC) protocol compiler"
cd $builddir
install -m755 -D tools/rpcgen/rpcgen "$subpkgdir"/usr/bin/rpcgen
install -Dm755 "$builddir"/tools/rpcgen/rpcgen \
"$subpkgdir"/usr/bin/rpcgen
}
sha512sums="ed358280b7e124154632040bf747f6e4c3c6e4156bf90e82ff6915b1488f1c0dd65251a3a0f9b7ca96b9664d64e24b379828da9b524e64a3c769a44f4c930448 nfs-utils-2.1.1.tar.bz2
9561a979a2313f00c0bbb2ffb3193ca089e5de2f15cf5b6c142e65e04a9401bbc962e490e5b1de026750262a05e5258b286a79781444e7f2ac6bd581b426211a 0011-exportfs-only-do-glibc-specific-hackery-on-glibc.patch
5fd9039a61a0cdaeb57b5332ea545034101e6f15be200b7cf8fc7d0a3d22836a6fc778e0560656c1825808a4dc09046d9923d81b4d1324a6e526b226c657d064 nfs-utils-mtab-sym.patch
a14fc747cc75f65bb206b28eb4f838ae85687c917893531318d3991adc3ed9914316b97fc507bf34881855c9978ad9d4617f33e464d1a0d746a65b31177687c1 musl-getservbyport.patch
d29003bb45207bc2c5074a394f7b7431e3aca97364f9c4da946d09b8755df356ce1a446d14d64fc8847c5f275a2b96cb03ec99de4e0fad81973a4a614360331d nfs.initd
8301a8981b6103398ec6e6aa234bdaab27762c96d3e3023e3ee7663b2f8dffab27338f4bd1b16f6584eba5ecb52e6b46aa5619fa4d5d7916f5e015881149cfaa nfsmount.initd
8bb94bf583a44b77ee7c3fe2d9302dfa026388534ba0d60803b4ade789180c6fcc5bb801c268dad2a2ae5ea3df015f06504e1adf606f5264b30293cae682a5fd rpc.gssd.initd
a9f00a6713a359a7c3bad5af660b1f99850b8c8c747371285a8b5f298578a72f3fbfd131119b6e74c7e4e5f5942f8376caa44c1475cc52c078e3cd96b1b51ce4 rpc.idmapd.initd
19ec69635cbbadae1a13f691d4a10778876c4218682b00794cc6cec88a90b016b92c32023c386536cdc1d9b9ae6a7c22817555b435a0e231c244d70d5ee8be59 rpc.pipefs.initd
519affb7ecd8ebd454058dcd4a4163ae53751bf53e105b9914c88b51c91dccb552863c6b68885361d8f4474b4881d36f64003abc6bd192e8f361fa1c1a3ac128 rpc.statd.initd
da07974bd7f191de683a0f83f8d87a5cfd116e233a1e70985820e7c2a0f8d39ec17d312f01f65ffccbc4f5b9180add2bbe171df2de3780a8dcf4df0bbfe9e31c rpc.svcgssd.initd
1711803f848f73fef9fa74bd572fa7643c586f06eeedf62ed91bd2aa06ad59c7b1f1c585b6f7b7a8ce67ff7fd6b601d88dc99ca1000dd1d3f5991f420da9761b nfs.confd
70f96bb3a465ee0fa857a6e511051ca3ced9f5a5d1e6b8b32eec843a2067f2475d8979c724a3661de0a2b078eef143f55d75ed184d823841d9de5038da91fb91 nfs.exports"
f7feb79cfcab0478affb640d1e5ad059757c88d51cc790fd54cde2fd7ed2e3cfd8f7f4c2de993d99da03e8ce3bdfb2750a4cb997b850fe33d0ef76d9b91c9018 nfs.initd
89259b9f0878658d48792b5b2f42b43c966ed098dba1fecf9e07fb0de4aab37ad67655ea8dbcc2361ddab2b5013b2de35a03048a513aaeedf790e4b416a35a54 nfsmount.initd
6e23897885cc33c49d9c7353b456585a1e0c7300822edba81bc48ba4ccc18297adce137260cc0aa9487aa5ef0aab3eecf931532cfa5bd40fd03bc9e0ddacfb28 nfsmount.confd
d9d7eeebbe153d3c4784112ed6d50734b5619b3315bb1454f8163de2b78ed8f958029a0e1088de58e9b1b8069184aeab2c8f19af4b957b6be25e4f138960aeac rpc.gssd.initd
f3e88038cb040ffcbca76166f4322d37e39da00d144bc0a17aed4467ab10c6e626fcde6c407d0911d135bfab55622ad2e38ed93788b11459c5882ce60577fb45 rpc.idmapd.initd
3d3fa6e7ae01e27d27d88aba1e307c5293dd1cbc9d555737e03c4f1e17988518f4f1e7f7a38a7337f8e8961e8378cc4611769b04db7368460589a3b218ac6d6b rpc.pipefs.initd
7f6baea852fff91b88e15e432ba19f9da0a3e3510b6f550b553912cf3887ce176280367b62bcce2a044730a075e4c1f6d7df1a669556d42725dea6e6e8e967ac rpc.statd.initd
819cce4ae0a0f26bc74ce546e149b98420584240a594c9bb4a0a49413750320bde050866f3753c499425ea8d8df094211fb1f7e020ce281791e1933e1bc6a47f rpc.svcgssd.initd
bc11b073735ee86c96b9c249ee187f4d16329c279a4e26760875059d2b5fa1d510ef3e4df5ee9dfb2a3133d755e1eb5c323d2fadc432a0cf630191ec353ac535 nfs.confd
70f96bb3a465ee0fa857a6e511051ca3ced9f5a5d1e6b8b32eec843a2067f2475d8979c724a3661de0a2b078eef143f55d75ed184d823841d9de5038da91fb91 nfs.exports
85078e2cd38b37a1e6fbaf0e40cf7690f403e71d9c8188d542d12fe56bfc02a49763c7bcc7742691754acc37928468c215db2795bebc29a5dfb052ba08f407bb nfsclient.initd
f12e67728ac4e76357685e2fe38bd7f6fcd90064165758ffeca145e6962ac44d4ff9d8d57e18cc6925a6ada8e95ad8321e9fc355931a804dd455aae1e4850e92 nfsclient.confd"
......@@ -3,7 +3,11 @@
# If you wish to set the port numbers for lockd,
# please see /etc/sysctl.conf
# Number of servers to be started up by default
# Optional services to include in default `/etc/init.d/nfs start`
# For NFSv4 users, you'll want to add "rpc.idmapd" here.
NFS_NEEDED_SERVICES=""
# Options to pass to rpc.nfsd
OPTS_RPC_NFSD="8"
# Options to pass to rpc.mountd
......@@ -28,3 +32,7 @@ OPTS_RPC_RQUOTAD=""
# Timeout (in seconds) for exportfs
EXPORTFS_TIMEOUT=30
# Options to set in the nfsd filesystem (/proc/fs/nfsd/).
# Format is <option>=<value>. Multiple options are allowed.
#OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096"
#!/sbin/openrc-run
# Copyright 1999-2009 Gentoo Foundation
# Copyright 1999-2014 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.19 2009/05/30 22:01:43 vapier Exp $
extra_started_commans="reload"
extra_started_commands="reload"
# This variable is used for controlling whether or not to run exportfs -ua;
# see stop() for more information
......@@ -17,12 +16,18 @@ smnotify=/usr/sbin/sm-notify
depend() {
local myneed=""
if [ -e /etc/exports ] ; then
if awk '!/^[[:space:]]*#/ && $2 ~ /sec=/ { exit 0 } END { exit 1 }' /etc/exports ; then
myneed="${myneed} rpc.svcgssd"
fi
fi
config /etc/exports
# XXX: no way to detect NFSv4 is desired and so need rpc.idmapd
myneed="${myneed} $(
awk '!/^[[:space:]]*#/ {
# clear the path to avoid spurious matches
$1 = "";
if ($0 ~ /[(][^)]*sec=(krb|spkm)[^)]*[)]/) {
print "rpc.svcgssd"
exit 0
}
}' /etc/exports /etc/exports.d/*.exports 2>/dev/null
)"
config /etc/exports /etc/exports.d/*.exports
need portmap rpc.statd ${myneed} ${NFS_NEEDED_SERVICES}
use ypbind net dns rpc.rquotad rpc.idmapd rpc.svcgssd
after quota
......@@ -30,7 +35,7 @@ depend() {
mkdir_nfsdirs() {
local d
for d in rpc_pipefs v4recovery v4root ; do
for d in v4recovery v4root ; do
d="/var/lib/nfs/${d}"
[ ! -d "${d}" ] && mkdir -p "${d}"
done
......@@ -38,7 +43,7 @@ mkdir_nfsdirs() {
waitfor_exportfs() {
local pid=$1
( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 $pid 2>/dev/null ) &
( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 ${pid} 2>/dev/null ) &
wait $1
}
......@@ -56,11 +61,16 @@ mount_nfsd() {
# 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/nfsd" /proc/mounts ; then
if ! mountinfo -q /proc/fs/nfsd ; then
ebegin "Mounting nfsd filesystem in /proc"
mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
eend $?
fi
local o
for o in ${OPTS_NFSD} ; do
echo "${o#*=}" > "/proc/fs/nfsd/${o%%=*}"
done
fi
}
......@@ -78,7 +88,7 @@ start() {
# 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
if grep -qs '^[[:space:]]*/' /etc/exports /etc/exports.d/*.exports ; then
ebegin "Exporting NFS directories"
${exportfs} -r &
waitfor_exportfs $!
......@@ -95,16 +105,14 @@ start() {
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 --oknodo --exec ${mountd}
start-stop-daemon --stop --exec ${mountd}
eend $?
ret=$((ret + $?))
# nfsd sets its process name to [nfsd] so don't look for $nfsd
ebegin "Stopping NFS daemon"
start-stop-daemon --stop --oknodo --name nfsd --user root --signal 2
start-stop-daemon --stop --name nfsd --user root --signal 2
eend $?
ret=$((ret + $?))
# in case things don't work out ... #228127
......
# You need to decide which nfs protocol version you want to use.
# If you are unsure, leave these alone.
#
# If you are using only nfsv4, uncomment this line:
#
#rc_need="!rpc.statd"
#
# If you are using only nfsv3, uncomment this line:
#
#rc_need="!rpc.idmapd"
#
# You will need to set the dependencies in the nfsclient script to match
# the network configuration tools you are using. This should be done in
# this file by following the examples below, and not by changing the
# service script itself. See /etc/conf.d/netmount for more examples.
#
# This is a safe default.
rc_after="net"
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
depend() {
local opts myneed=""
if [ -e /etc/fstab ] ; then
for opts in $(fstabinfo -o -t nfs,nfs4) ; do
case $opts in
*sec=krb*|*sec=spkm*) myneed="$myneed rpc.gssd" ;;
esac
done
fi
config /etc/fstab
need portmap rpc.statd rpc.idmapd ${myneed}
use ypbind dns
}
start() {
if [ -x /usr/sbin/sm-notify ] ; then
ebegin "Starting NFS sm-notify"
/usr/sbin/sm-notify ${OPTS_SMNOTIFY}
eend $?
fi
# Make sure nfs support is loaded in the kernel #64709
if [ -e /proc/modules ] && ! grep -qs 'nfs$' /proc/filesystems ; then
modprobe -q nfs
fi
return 0
}
# You will need to set the dependencies in the nfsmount script to match
# the network configuration tools you are using. This should be done in
# this file by following the examples below, and not by changing the
# service script itself. See /etc/conf.d/netmount for more examples.
#
# This is a safe default.
rc_after="net"
#!/sbin/openrc-run
# Copyright 1999-2009 Gentoo Foundation
# Copyright 1999-2013 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.13 2009/01/31 22:15:02 vapier Exp $
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
depend() {
local myneed=""
if [ -e /etc/fstab ] ; then
awk '!/^[[:space:]]*#/ && $3 == "nfs4" { exit ($4 ~ /sec=krb/ ? 10 : 20) }' /etc/fstab
local ret=$?
[ ${ret} -eq 10 ] && myneed="${myneed} rpc.gssd"
[ ${ret} -eq 20 ] && myneed="${myneed} rpc.idmapd"
myneed="${myneed} $(
awk '!/^[[:space:]]*#/ && ($3 == "nfs" || $3 == "nfs4") {
if ($3 == "nfs4")
idmapd = "rpc.idmapd"
if ($4 ~ /sec=(krb|spkm)/)
gssd = "rpc.gssd"
}
END { print idmapd " " gssd }
' /etc/fstab
)"
fi
config /etc/fstab
need net portmap rpc.statd ${myneed}
need portmap rpc.statd ${myneed}
use ypbind dns rpc.idmapd rpc.gssd
}
......
#!/sbin/openrc-run
# Copyright 1999-2008 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.11 2008/10/26 09:02:47 vapier Exp $
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
......
#!/sbin/openrc-run
# Copyright 1999-2008 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.8 2009/03/14 18:43:18 vapier Exp $
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
......
#!/sbin/openrc-run
# Copyright 1999-2008 Gentoo Foundation
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.pipefs.initd,v 1.1 2008/10/26 09:02:47 vapier Exp $
MNT="/var/lib/nfs/rpc_pipefs"
mount_pipefs() {
local fstype=rpc_pipefs
# if things are already mounted, nothing to do
mountinfo -q ${MNT} && return 0
# if rpc_pipefs is not available, try to load sunrpc for it #219566
grep -qs rpc_pipefs /proc/filesystems || modprobe -q sunrpc
# if still not available, let's bail
grep -qs rpc_pipefs /proc/filesystems || return 1
grep -qs ${fstype} /proc/filesystems || modprobe -q sunrpc
# if still not available, the `mount` will issue an error for the user
# now just do it for kicks
mkdir -p /var/lib/nfs/rpc_pipefs
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
mkdir -p ${MNT}
mount -t ${fstype} ${fstype} ${MNT}
}
start() {
# if things are already mounted, let's just return
grep -qs "rpc_pipefs /var/lib/nfs/rpc_pipefs" /proc/mounts && return 0
ebegin "Mounting RPC pipefs"
ebegin "Setting up RPC pipefs"
mount_pipefs
eend $? "make sure you have NFS/SUNRPC enabled in your kernel"
}
stop() {
ebegin "Unmounting RPC pipefs"
umount ${MNT}
eend $?
}
#!/sbin/openrc-run
# Copyright 1999-2009 Gentoo Foundation
# Copyright 1999-2015 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.7 2009/01/31 22:16:11 vapier Exp $
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
rpc_bin=/usr/sbin/rpc.statd
rpc_bin=/sbin/rpc.statd
rpc_pid=/var/run/rpc.statd.pid
depend() {
......
#!/sbin/openrc-run
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.svcgssd.initd,v 1.5 2008/10/26 09:02:47 vapier Exp $
[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment