blob: 21df1803c5f87b2b2d32629b9e2694be270210d2 [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 \
Andrew Geissler517393d2023-01-13 08:55:19 -060035 file://0001-Replace-statfs64-with-statfs.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050036 "
37SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011"
38
39# Only kernel-module-nfsd is required here (but can be built-in) - the nfsd module will
40# pull in the remainder of the dependencies.
41
42INITSCRIPT_PACKAGES = "${PN} ${PN}-client"
43INITSCRIPT_NAME = "nfsserver"
44INITSCRIPT_PARAMS = "defaults"
45INITSCRIPT_NAME:${PN}-client = "nfscommon"
46INITSCRIPT_PARAMS:${PN}-client = "defaults 19 21"
47
48inherit autotools-brokensep update-rc.d systemd pkgconfig
49
50SYSTEMD_PACKAGES = "${PN} ${PN}-client"
51SYSTEMD_SERVICE:${PN} = "nfs-server.service nfs-mountd.service"
52SYSTEMD_SERVICE:${PN}-client = "nfs-statd.service"
53
54# --enable-uuid is need for cross-compiling
55EXTRA_OECONF = "--with-statduser=rpcuser \
56 --enable-mountconfig \
57 --enable-libmount-mount \
58 --enable-uuid \
59 --disable-gss \
60 --disable-nfsdcltrack \
61 --with-statdpath=/var/lib/nfs/statd \
62 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
63 "
64
65PACKAGECONFIG ??= "tcp-wrappers \
66 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
67"
68PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
69PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
70PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
71# libdevmapper is available in meta-oe
72PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
73# keyutils is available in meta-oe
74PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
75
76PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"
77
78CONFFILES:${PN}-client += "${localstatedir}/lib/nfs/etab \
79 ${localstatedir}/lib/nfs/rmtab \
80 ${localstatedir}/lib/nfs/xtab \
81 ${localstatedir}/lib/nfs/statd/state \
82 ${sysconfdir}/nfsmount.conf"
83
84FILES:${PN}-client = "${sbindir}/*statd \
85 ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
86 ${sbindir}/showmount ${sbindir}/nfsstat \
87 ${localstatedir}/lib/nfs \
88 ${sysconfdir}/nfs-utils.conf \
89 ${sysconfdir}/nfsmount.conf \
90 ${sysconfdir}/init.d/nfscommon \
91 ${systemd_system_unitdir}/nfs-statd.service"
92RDEPENDS:${PN}-client = "${PN}-mount rpcbind"
93
94FILES:${PN}-mount = "${base_sbindir}/*mount.nfs*"
95
96FILES:${PN}-stats = "${sbindir}/mountstats ${sbindir}/nfsiostat ${sbindir}/nfsdclnts"
97RDEPENDS:${PN}-stats = "python3-core"
98
99FILES:${PN}-rpcctl = "${sbindir}/rpcctl"
100RDEPENDS:${PN}-rpcctl = "python3-core"
101
102FILES:${PN}-staticdev += "${libdir}/libnfsidmap/*.a"
103
104FILES:${PN} += "${systemd_unitdir} ${libdir}/libnfsidmap/ ${nonarch_libdir}/modprobe.d"
105
106do_configure:prepend() {
107 sed -i -e 's,sbindir = /sbin,sbindir = ${base_sbindir},g' \
108 ${S}/utils/mount/Makefile.am
109}
110
111# Make clean needed because the package comes with
112# precompiled 64-bit objects that break the build
113do_compile:prepend() {
114 make clean
115}
116
117# Works on systemd only
118HIGH_RLIMIT_NOFILE ??= "4096"
119
120do_install:append () {
121 install -d ${D}${sysconfdir}/init.d
122 install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
123 install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
124
125 install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir}
126 install -m 0755 ${S}/utils/mount/nfsmount.conf ${D}${sysconfdir}
127
128 install -d ${D}${systemd_system_unitdir}
129 install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
130 install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
131 install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
132 sed -i -e 's,@SBINDIR@,${sbindir},g' \
133 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
134 -e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
135 ${D}${systemd_system_unitdir}/*.service
136 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
137 install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
138 install -d ${D}${systemd_system_unitdir}/sysinit.target.wants/
139 ln -sf ../proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/proc-fs-nfsd.mount
140 fi
141
142 # kernel code as of 3.8 hard-codes this path as a default
143 install -d ${D}/var/lib/nfs/v4recovery
144
145 # chown the directories and files
146 chown -R rpcuser:rpcuser ${D}${localstatedir}/lib/nfs/statd
147 chmod 0644 ${D}${localstatedir}/lib/nfs/statd/state
148
149 # Make python tools use python 3
150 sed -i -e '1s,#!.*python.*,#!${bindir}/python3,' ${D}${sbindir}/mountstats ${D}${sbindir}/nfsiostat
151}