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