summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2009-04-08 09:47:02 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2009-04-08 09:47:02 +0000
commita07d3df748a32c8f87161df1679a042f2f366a87 (patch)
tree14ce7d68b36ea7828d2db644a082ce4b419e4f9d /extra
parentd437587cbbab753a400f07c1f44106f79d279cf3 (diff)
downloadaports-a07d3df748a32c8f87161df1679a042f2f366a87.tar.bz2
aports-a07d3df748a32c8f87161df1679a042f2f366a87.tar.xz
extra/nfs-utils: new aport
Diffstat (limited to 'extra')
-rw-r--r--extra/nfs-utils/APKBUILD54
-rw-r--r--extra/nfs-utils/nfs-utils-mtab-sym.patch38
-rw-r--r--extra/nfs-utils/nfs-utils-no-exec.patch13
-rw-r--r--extra/nfs-utils/nfs-utils-rpc.patch11
-rw-r--r--extra/nfs-utils/nfs.confd30
-rw-r--r--extra/nfs-utils/nfs.exports7
-rw-r--r--extra/nfs-utils/nfs.initd154
7 files changed, 307 insertions, 0 deletions
diff --git a/extra/nfs-utils/APKBUILD b/extra/nfs-utils/APKBUILD
new file mode 100644
index 00000000..8d144ab3
--- /dev/null
+++ b/extra/nfs-utils/APKBUILD
@@ -0,0 +1,54 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+pkgname=nfs-utils
+pkgver=1.1.5
+pkgrel=0
+pkgdesc="kernel-mode NFS"
+url="http://nfs.sourceforge.net/"
+license="GPL"
+depends="uclibc portmap"
+makedepends=""
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/nfs/$pkgname-$pkgver.tar.bz2
+ nfs.initd
+ nfs.confd
+ nfs.exports
+ nfs-utils-rpc.patch
+ nfs-utils-no-exec.patch
+ nfs-utils-mtab-sym.patch"
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ for i in "$srcdir"/*.patch; do
+ 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 \
+ --disable-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="2848072a5e53840b9bc520fbb6782b57 nfs-utils-1.1.5.tar.bz2
+4538f67470c916f8da9c76a17e314906 nfs.initd
+09135438d6df50b868bbe5a2260f973c nfs.confd
+4f1bb7b2412ce5952ecb5ec22d8ed99d nfs.exports
+dd9a90ce39cf8c725fdbf65d1139447f nfs-utils-rpc.patch
+5e0963b0889e779ff36af0299d17d6cb nfs-utils-no-exec.patch
+a3a7338f8de3ac37c1ffc05bdcb77d16 nfs-utils-mtab-sym.patch"
diff --git a/extra/nfs-utils/nfs-utils-mtab-sym.patch b/extra/nfs-utils/nfs-utils-mtab-sym.patch
new file mode 100644
index 00000000..1ebbd99b
--- /dev/null
+++ b/extra/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/extra/nfs-utils/nfs-utils-no-exec.patch b/extra/nfs-utils/nfs-utils-no-exec.patch
new file mode 100644
index 00000000..94a73d36
--- /dev/null
+++ b/extra/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/extra/nfs-utils/nfs-utils-rpc.patch b/extra/nfs-utils/nfs-utils-rpc.patch
new file mode 100644
index 00000000..b05b67a6
--- /dev/null
+++ b/extra/nfs-utils/nfs-utils-rpc.patch
@@ -0,0 +1,11 @@
+--- tools/rpcgen/rpc_main.c Tue Apr 7 21:53:12 2009
++++ tools/rpcgen/rpc_main.c Tue Apr 7 21:53:12 2009
+@@ -550,7 +550,7 @@
+ f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
+ #else
+ if( !tirpcflag )
+- f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
++ f_print(fout, "#include <sys/ioctl.h>/* TIOCNOTTY */\n");
+ #endif
+ if( Cflag && (inetdflag || pmflag ) ) {
+ f_print(fout, "#ifdef __cplusplus\n");
diff --git a/extra/nfs-utils/nfs.confd b/extra/nfs-utils/nfs.confd
new file mode 100644
index 00000000..98a143a6
--- /dev/null
+++ b/extra/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/extra/nfs-utils/nfs.exports b/extra/nfs-utils/nfs.exports
new file mode 100644
index 00000000..dc0b8392
--- /dev/null
+++ b/extra/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/extra/nfs-utils/nfs.initd b/extra/nfs-utils/nfs.initd
new file mode 100644
index 00000000..e9711d91
--- /dev/null
+++ b/extra/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
+}