summaryrefslogtreecommitdiffstats
path: root/main/nfs-utils
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
commitb70981b68efcce5256eb11c6cd26ae123b10b6ea (patch)
treea38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/nfs-utils
parent2b4df81538b8398442d5296650905c70341dd8d3 (diff)
downloadaports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2
aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/nfs-utils')
-rw-r--r--main/nfs-utils/APKBUILD54
-rw-r--r--main/nfs-utils/nfs-utils-mtab-sym.patch38
-rw-r--r--main/nfs-utils/nfs-utils-no-exec.patch13
-rw-r--r--main/nfs-utils/nfs.confd30
-rw-r--r--main/nfs-utils/nfs.exports7
-rw-r--r--main/nfs-utils/nfs.initd154
6 files changed, 296 insertions, 0 deletions
diff --git a/main/nfs-utils/APKBUILD b/main/nfs-utils/APKBUILD
new file mode 100644
index 000000000..b9225f966
--- /dev/null
+++ b/main/nfs-utils/APKBUILD
@@ -0,0 +1,54 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=nfs-utils
+pkgver=1.2.0
+pkgrel=0
+pkgdesc="kernel-mode NFS"
+url="http://nfs.sourceforge.net/"
+license="GPL"
+depends="portmap"
+makedepends="e2fsprogs-dev"
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/nfs/$pkgname-$pkgver.tar.bz2
+ nfs.initd
+ nfs.confd
+ nfs.exports
+ nfs-utils-no-exec.patch
+ nfs-utils-mtab-sym.patch"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for i in "$srcdir"/*.patch; do
+ msg "Applying $i"
+ patch -p0 -i "${i}" || return 1
+ done
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --without-tcp-wrappers \
+ --disable-nfsv4 \
+ --enable-uuid \
+ --disable-gss \
+ --enable-mount \
+ --enable-nfsv3 \
+ --with-statedir=/var/lib/nfs
+
+ make || return 1
+ make -j1 DESTDIR="$pkgdir" install
+
+ install -m755 -D "$srcdir"/nfs.initd "$pkgdir"/etc/init.d/nfs
+ install -m644 -D "$srcdir"/nfs.confd "$pkgdir"/etc/conf.d/nfs
+ install -m644 -D "$srcdir"/nfs.exports "$pkgdir"/etc/exports
+ #mkdir -p "$pkgdir"/usr/lib/nfs
+ install -m755 -D tools/rpcgen/rpcgen "$pkgdir"/usr/bin/rpcgen
+}
+
+md5sums="779cf81044e92cb51ad590960e7b3671 nfs-utils-1.2.0.tar.bz2
+4538f67470c916f8da9c76a17e314906 nfs.initd
+09135438d6df50b868bbe5a2260f973c nfs.confd
+4f1bb7b2412ce5952ecb5ec22d8ed99d nfs.exports
+5e0963b0889e779ff36af0299d17d6cb nfs-utils-no-exec.patch
+a3a7338f8de3ac37c1ffc05bdcb77d16 nfs-utils-mtab-sym.patch"
diff --git a/main/nfs-utils/nfs-utils-mtab-sym.patch b/main/nfs-utils/nfs-utils-mtab-sym.patch
new file mode 100644
index 000000000..1ebbd99b5
--- /dev/null
+++ b/main/nfs-utils/nfs-utils-mtab-sym.patch
@@ -0,0 +1,38 @@
+--- utils/mount/fstab.c
++++ utils/mount/fstab.c
+@@ -57,7 +57,7 @@ mtab_does_not_exist(void) {
+ return var_mtab_does_not_exist;
+ }
+
+-static int
++int
+ mtab_is_a_symlink(void) {
+ get_mtab_info();
+ return var_mtab_is_a_symlink;
+--- utils/mount/fstab.h
++++ utils/mount/fstab.h
+@@ -7,6 +7,7 @@
+ #define _PATH_FSTAB "/etc/fstab"
+ #endif
+
++int mtab_is_a_symlink(void);
+ int mtab_is_writable(void);
+ int mtab_does_not_exist(void);
+ void reset_mtab_info(void);
+--- utils/mount/mount.c
++++ utils/mount/mount.c
+@@ -230,6 +230,13 @@ create_mtab (void) {
+ int flags;
+ mntFILE *mfp;
+
++ /* Avoid writing if the mtab is a symlink to /proc/mounts, since
++ that would create a file /proc/mounts in case the proc filesystem
++ is not mounted, and the fchmod below would also fail. */
++ if (mtab_is_a_symlink()) {
++ return EX_SUCCESS;
++ }
++
+ lock_mtab();
+
+ mfp = nfs_setmntent (MOUNTED, "a+");
+
diff --git a/main/nfs-utils/nfs-utils-no-exec.patch b/main/nfs-utils/nfs-utils-no-exec.patch
new file mode 100644
index 000000000..94a73d366
--- /dev/null
+++ b/main/nfs-utils/nfs-utils-no-exec.patch
@@ -0,0 +1,13 @@
+--- utils/mount/mount.c Wed Apr 8 09:25:26 2009
++++ utils/mount/mount.c Wed Apr 8 09:25:26 2009
+@@ -407,10 +407,6 @@
+ mount_error(NULL, mount_point, ENOTDIR);
+ return 1;
+ }
+- if (access(mount_point, X_OK) < 0) {
+- mount_error(NULL, mount_point, errno);
+- return 1;
+- }
+
+ return 0;
+ }
diff --git a/main/nfs-utils/nfs.confd b/main/nfs-utils/nfs.confd
new file mode 100644
index 000000000..98a143a65
--- /dev/null
+++ b/main/nfs-utils/nfs.confd
@@ -0,0 +1,30 @@
+# /etc/conf.d/nfs
+
+# If you wish to set the port numbers for lockd,
+# please see /etc/sysctl.conf
+
+# Number of servers to be started up by default
+OPTS_RPC_NFSD="8"
+
+# Options to pass to rpc.mountd
+# ex. OPTS_RPC_MOUNTD="-p 32767"
+OPTS_RPC_MOUNTD=""
+
+# Options to pass to rpc.statd
+# ex. OPTS_RPC_STATD="-p 32765 -o 32766"
+OPTS_RPC_STATD=""
+
+# Options to pass to rpc.idmapd
+OPTS_RPC_IDMAPD=""
+
+# Options to pass to rpc.gssd
+OPTS_RPC_GSSD=""
+
+# Options to pass to rpc.svcgssd
+OPTS_RPC_SVCGSSD=""
+
+# Options to pass to rpc.rquotad (requires sys-fs/quota)
+OPTS_RPC_RQUOTAD=""
+
+# Timeout (in seconds) for exportfs
+EXPORTFS_TIMEOUT=30
diff --git a/main/nfs-utils/nfs.exports b/main/nfs-utils/nfs.exports
new file mode 100644
index 000000000..dc0b83927
--- /dev/null
+++ b/main/nfs-utils/nfs.exports
@@ -0,0 +1,7 @@
+# /etc/exports
+#
+# See exports(5) for a description.
+
+# use exportfs -arv to reread
+#/export 192.168.1.10(rw,no_root_squash)
+
diff --git a/main/nfs-utils/nfs.initd b/main/nfs-utils/nfs.initd
new file mode 100644
index 000000000..e9711d914
--- /dev/null
+++ b/main/nfs-utils/nfs.initd
@@ -0,0 +1,154 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-fs/nfs-utils/files/nfs.initd,v 1.18 2009/02/27 01:41:55 vapier Exp $
+
+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
+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
+ need portmap rpc.statd ${myneed}
+ use ypbind net dns rpc.rquotad rpc.idmapd rpc.svcgssd
+ after quota
+}
+
+mkdir_nfsdirs() {
+ local d
+ for d in rpc_pipefs v4recovery v4root ; do
+ d="/var/lib/nfs/${d}"
+ [ ! -d "${d}" ] && mkdir -p "${d}"
+ done
+}
+
+waitfor_exportfs() {
+ local pid=$1
+ ( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 $pid 2>/dev/null ) &
+ wait $1
+}
+
+mount_nfsd() {
+ if [ -e /proc/modules ] ; then
+ # Make sure nfs support is loaded in the kernel #64709
+ if ! grep -qs nfsd /proc/filesystems ; then
+ modprobe -q nfsd
+ fi
+ # Restart idmapd if needed #220747
+ if grep -qs nfsd /proc/modules ; then
+ killall -q -HUP rpc.idmapd
+ fi
+ 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/nfsd" /proc/mounts ; then
+ ebegin "Mounting nfsd filesystem in /proc"
+ mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
+ eend $?
+ fi
+ fi
+}
+
+start_it() {
+ ebegin "Starting NFS $1"
+ shift
+ "$@"
+ eend $?
+ ret=$((ret + $?))
+}
+start() {
+ mount_nfsd
+ 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 mountd ${mountd} ${OPTS_RPC_MOUNTD}
+ start_it daemon ${nfsd} ${OPTS_RPC_NFSD}
+ [ -x "${smnotify}" ] && start_it smnotify ${smnotify} ${OPTS_SMNOTIFY}
+ 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 --oknodo --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
+ eend $?
+ ret=$((ret + $?))
+ # in case things don't work out ... #228127
+ rpc.nfsd 0
+
+ # 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 -o "${RC_CMD}" = "restart" ] ; 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
+}