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