Browse Source

nfs-kernel-server: import from packages

Signed-off-by: Peter Wagner <tripolar@gmx.at>
lilik-openwrt-22.03
Peter Wagner 11 years ago
parent
commit
7fedc0c35b
5 changed files with 237 additions and 0 deletions
  1. +152
    -0
      net/nfs-kernel-server/Makefile
  2. +1
    -0
      net/nfs-kernel-server/files/nfsd.exports
  3. +38
    -0
      net/nfs-kernel-server/files/nfsd.init
  4. +36
    -0
      net/nfs-kernel-server/patches/100-nfs_utils_uclibc.patch
  5. +10
    -0
      net/nfs-kernel-server/patches/101-no_malloc_h.patch

+ 152
- 0
net/nfs-kernel-server/Makefile View File

@ -0,0 +1,152 @@
# Copyright (C) 2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=nfs-kernel-server
PKG_VERSION:=1.3.0
PKG_RELEASE:=1
PKG_MD5SUM:=3ac3726eda563946d1f44ac3e5b61d56
PKG_SOURCE_URL:=@SF/nfs
PKG_SOURCE:=nfs-utils-$(PKG_VERSION).tar.bz2
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/nfs-utils-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/nfs-utils-$(PKG_VERSION)
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=$(PKG_NAME)/host
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/nfs-kernel-server/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Filesystem
DEPENDS:=+libwrap +libblkid +libuuid $(LIBRPC_DEPENDS)
URL:=http://nfs.sourceforge.net/
endef
define Package/nfs-kernel-server
$(call Package/nfs-kernel-server/Default)
TITLE:=Kernel NFS server support
DEPENDS+= +kmod-fs-nfsd +kmod-fs-nfs +portmap
endef
define Package/nfs-kernel-server/description
Kernel NFS server support
endef
define Package/nfs-kernel-server-utils
$(call Package/nfs-kernel-server/Default)
TITLE:=NFS server utils
DEPENDS:=nfs-kernel-server
endef
define Package/nfs-kernel-server-utils/description
NFS server utils
endef
define Package/nfs-kernel-server/conffiles
/etc/exports
endef
define Package/nfs-utils
$(call Package/nfs-kernel-server/Default)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS+= +libevent +USE_UCLIBC:librpc
TITLE:=updated mount utility (includes nfs4)
endef
define Package/nfs-utils/description
Updated mount.nfs command - allows mounting nfs4 volumes
endef
TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/lib -I$(STAGING_DIR)/usr/include/libevent \
-I$(STAGING_DIR)/usr/include/ -Drpc_uint=uint
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib $(LIBRPC) \
-L$(STAGING_DIR)/usr/lib/libevent
CONFIGURE_ARGS += \
--disable-gss \
--disable-nfsv4 \
--disable-nfsv41 \
--enable-static \
--enable-shared \
--disable-caps \
--disable-tirpc \
--disable-nfsdcld
CONFIGURE_VARS += \
CONFIG_SQLITE3_TRUE="\#" \
CONFIG_NFSDCLD_TRUE="\#"
MAKE_FLAGS += \
OPT="$(TARGET_CFLAGS)" \
INSTALLSUID="install -m 4755" \
DESTDIR="$(PKG_INSTALL_DIR)" \
RPCGEN_PATH=$(STAGING_DIR_HOST)/bin/rpcgen \
RPCGEN=$(STAGING_DIR_HOST)/bin/rpcgen
HOST_CFLAGS += -Dlinux
HOST_CONFIGURE_ARGS += \
--disable-gss \
--disable-nfsv4 \
--disable-nfsv41 \
--without-tcp-wrappers
HOST_CONFIGURE_VARS += \
ac_cv_lib_event_event_dispatch=yes \
ac_cv_lib_nfsidmap_nfs4_init_name_mapping=yes \
ac_cv_lib_blkid_blkid_get_library_version=yes \
ac_cv_header_event_h=yes \
ac_cv_header_nfsidmap_h=yes \
ac_cv_header_blkid_blkid_h=yes \
GSSGLUE_CFLAGS=" " \
GSSGLUE_LIBS=" " \
RPCSECGSS_CFLAGS=" " \
RPCSECGSS_LIBS=" " \
CONFIG_SQLITE3_TRUE="\#" \
CONFIG_NFSDCLD_TRUE="\#"
define Host/Compile
$(MAKE) -C $(HOST_BUILD_DIR)/tools/rpcgen all
endef
define Host/Install
$(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/rpcgen/rpcgen $(STAGING_DIR_HOST)/bin/rpcgen
endef
define Package/nfs-kernel-server/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
$(INSTALL_DATA) ./files/nfsd.exports $(1)/etc/exports
$(INSTALL_BIN) ./files/nfsd.init $(1)/etc/init.d/nfsd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/sm-notify $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/statd/statd $(1)/usr/sbin/rpc.statd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsd/nfsd $(1)/usr/sbin/rpc.nfsd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/mountd/mountd $(1)/usr/sbin/rpc.mountd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/exportfs/exportfs $(1)/usr/sbin/
endef
define Package/nfs-kernel-server-utils/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/showmount/showmount $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utils/nfsstat/nfsstat $(1)/usr/sbin
endef
define Package/nfs-utils/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/sbin/mount.nfs $(1)/sbin/
(cd $(1)/sbin; ln -sf mount.nfs mount.nfs4; ln -sf mount.nfs umount.nfs; ln -sf mount.nfs umount.nfs4)
endef
$(eval $(call HostBuild))
$(eval $(call BuildPackage,nfs-kernel-server))
$(eval $(call BuildPackage,nfs-kernel-server-utils))
$(eval $(call BuildPackage,nfs-utils))

+ 1
- 0
net/nfs-kernel-server/files/nfsd.exports View File

@ -0,0 +1 @@
/mnt *(ro,all_squash,insecure,sync)

+ 38
- 0
net/nfs-kernel-server/files/nfsd.init View File

@ -0,0 +1,38 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=99
STOP=60
USE_PROCD=1
NFS_D=/var/lib/nfs
LOCK_D=/var/lib/nfs/sm
start_service() {
grep -q /proc/fs/nfsd /proc/mounts || \
mount -t nfsd nfsd /proc/fs/nfsd
mkdir -p $NFS_D
mkdir -p $LOCK_D
touch $NFS_D/rmtab
sysctl -w fs.nfs.nlm_tcpport=32777 fs.nfs.nlm_udpport=32777 > /dev/null
procd_open_instance
procd_set_param command /usr/sbin/rpc.statd -p 32778 -o 32779 -F
procd_close_instance
/usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd
procd_open_instance
procd_set_param command /usr/sbin/rpc.mountd -p 32780 -F
procd_close_instance
}
stop_service() {
rpc.nfsd 0 2> /dev/null
/usr/sbin/exportfs -au
grep -q /proc/fs/nfsd /proc/mounts && \
umount /proc/fs/nfsd
}

+ 36
- 0
net/nfs-kernel-server/patches/100-nfs_utils_uclibc.patch View File

@ -0,0 +1,36 @@
--- a/support/nfs/svc_socket.c
+++ b/support/nfs/svc_socket.c
@@ -40,10 +40,13 @@ int getservport(u_long number, const cha
char rpcdata[1024], servdata[1024];
struct rpcent rpcbuf, *rpcp;
struct servent servbuf, *servp = NULL;
- int ret;
-
+ int ret=0;
+#ifndef __UCLIBC__
ret = getrpcbynumber_r(number, &rpcbuf, rpcdata, sizeof rpcdata,
&rpcp);
+#else
+ rpcp = getrpcbynumber (number);
+#endif
if (ret == 0 && rpcp != NULL) {
/* First try name. */
ret = getservbyname_r(rpcp->r_name, proto, &servbuf, servdata,
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -166,6 +166,7 @@ static void auth_unix_gid(FILE *f)
pw = getpwuid(uid);
if (!pw)
rv = -1;
+#ifndef __UCLIBC__
else {
rv = getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
if (rv == -1 && ngroups >= groups_len) {
@@ -180,6 +181,7 @@ static void auth_unix_gid(FILE *f)
}
}
}
+#endif
qword_printuint(f, uid);
qword_printtimefrom(f, DEFAULT_TTL);
if (rv >= 0) {

+ 10
- 0
net/nfs-kernel-server/patches/101-no_malloc_h.patch View File

@ -0,0 +1,10 @@
--- a/tools/rpcgen/rpc_cout.c
+++ b/tools/rpcgen/rpc_cout.c
@@ -36,7 +36,6 @@ static char sccsid[] = "@(#)rpc_cout.c 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <malloc.h>
#include <ctype.h>
#include "rpc_parse.h"
#include "rpc_util.h"

Loading…
Cancel
Save