blob: 4b5c28c27bef640c6cd27ab18eb82bf89324305f [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001SUMMARY = "userspace utilities for kernel nfs"
2DESCRIPTION = "The nfs-utils package provides a daemon for the kernel \
3NFS server and related tools."
4HOMEPAGE = "http://nfs.sourceforge.net/"
5SECTION = "console/network"
6
7LICENSE = "MIT & GPL-2.0-or-later & BSD-3-Clause"
8LIC_FILES_CHKSUM = "file://COPYING;md5=95f3a93a5c3c7888de623b46ea085a84"
9
10# util-linux for libblkid
11DEPENDS = "libcap libevent util-linux sqlite3 libtirpc"
12RDEPENDS:${PN} = "${PN}-client"
13RRECOMMENDS:${PN} = "kernel-module-nfsd"
14
15inherit useradd
16
17USERADD_PACKAGES = "${PN}-client"
18USERADD_PARAM:${PN}-client = "--system --home-dir /var/lib/nfs \
19 --shell /bin/false --user-group rpcuser"
20
21SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.xz \
22 file://nfsserver \
23 file://nfscommon \
24 file://nfs-utils.conf \
25 file://nfs-server.service \
26 file://nfs-mountd.service \
27 file://nfs-statd.service \
28 file://proc-fs-nfsd.mount \
29 file://nfs-utils-debianize-start-statd.patch \
30 file://bugfix-adjust-statd-service-name.patch \
31 file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
32 file://clang-warnings.patch \
33 file://0005-mountd-Check-for-return-of-stat-function.patch \
34 file://0006-Fix-function-prototypes.patch \
35 "
36SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011"
37
38# Only kernel-module-nfsd is required here (but can be built-in) - the nfsd module will
39# pull in the remainder of the dependencies.
40
41INITSCRIPT_PACKAGES = "${PN} ${PN}-client"
42INITSCRIPT_NAME = "nfsserver"
43INITSCRIPT_PARAMS = "defaults"
44INITSCRIPT_NAME:${PN}-client = "nfscommon"
45INITSCRIPT_PARAMS:${PN}-client = "defaults 19 21"
46
47inherit autotools-brokensep update-rc.d systemd pkgconfig
48
49SYSTEMD_PACKAGES = "${PN} ${PN}-client"
50SYSTEMD_SERVICE:${PN} = "nfs-server.service nfs-mountd.service"
51SYSTEMD_SERVICE:${PN}-client = "nfs-statd.service"
52
53# --enable-uuid is need for cross-compiling
54EXTRA_OECONF = "--with-statduser=rpcuser \
55 --enable-mountconfig \
56 --enable-libmount-mount \
57 --enable-uuid \
58 --disable-gss \
59 --disable-nfsdcltrack \
60 --with-statdpath=/var/lib/nfs/statd \
61 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
62 "
63
64PACKAGECONFIG ??= "tcp-wrappers \
65 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
66"
67PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
68PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
69PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
70# libdevmapper is available in meta-oe
71PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
72# keyutils is available in meta-oe
73PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
74
75PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"
76
77CONFFILES:${PN}-client += "${localstatedir}/lib/nfs/etab \
78 ${localstatedir}/lib/nfs/rmtab \
79 ${localstatedir}/lib/nfs/xtab \
80 ${localstatedir}/lib/nfs/statd/state \
81 ${sysconfdir}/nfsmount.conf"
82
83FILES:${PN}-client = "${sbindir}/*statd \
84 ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
85 ${sbindir}/showmount ${sbindir}/nfsstat \
86 ${localstatedir}/lib/nfs \
87 ${sysconfdir}/nfs-utils.conf \
88 ${sysconfdir}/nfsmount.conf \
89 ${sysconfdir}/init.d/nfscommon \
90 ${systemd_system_unitdir}/nfs-statd.service"
91RDEPENDS:${PN}-client = "${PN}-mount rpcbind"
92
93FILES:${PN}-mount = "${base_sbindir}/*mount.nfs*"
94
95FILES:${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat ${sbindir}/nfsdclnts"
96RDEPENDS:${PN}-stats = "python3-core"
97
98FILES:${PN}-rpcctl = "${sbindir}/rpcctl"
99RDEPENDS:${PN}-rpcctl = "python3-core"
100
101FILES:${PN}-staticdev += "${libdir}/libnfsidmap/*.a"
102
103FILES:${PN} += "${systemd_unitdir} ${libdir}/libnfsidmap/ ${nonarch_libdir}/modprobe.d"
104
105do_configure:prepend() {
106 sed -i -e 's,sbindir = /sbin,sbindir = ${base_sbindir},g' \
107 ${S}/utils/mount/Makefile.am
108}
109
110# Make clean needed because the package comes with
111# precompiled 64-bit objects that break the build
112do_compile:prepend() {
113 make clean
114}
115
116# Works on systemd only
117HIGH_RLIMIT_NOFILE ??= "4096"
118
119do_install:append () {
120 install -d ${D}${sysconfdir}/init.d
121 install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
122 install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
123
124 install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir}
125 install -m 0755 ${S}/utils/mount/nfsmount.conf ${D}${sysconfdir}
126
127 install -d ${D}${systemd_system_unitdir}
128 install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
129 install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
130 install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
131 sed -i -e 's,@SBINDIR@,${sbindir},g' \
132 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
133 -e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
134 ${D}${systemd_system_unitdir}/*.service
135 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
136 install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
137 install -d ${D}${systemd_system_unitdir}/sysinit.target.wants/
138 ln -sf ../proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/proc-fs-nfsd.mount
139 fi
140
141 # kernel code as of 3.8 hard-codes this path as a default
142 install -d ${D}/var/lib/nfs/v4recovery
143
144 # chown the directories and files
145 chown -R rpcuser:rpcuser ${D}${localstatedir}/lib/nfs/statd
146 chmod 0644 ${D}${localstatedir}/lib/nfs/statd/state
147
148 # Make python tools use python 3
149 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${sbindir}/mountstats ${D}${sbindir}/nfsiostat
150}