new file mode 100644
@@ -0,0 +1,31 @@
+From f10db88174e73c78c028561715f16ed38148ebde Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <zboszor@gmail.com>
+Date: Fri, 26 Jul 2024 12:36:06 +0200
+Subject: [PATCH 1/2] Make the lockfile follow --with-statedir=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
+---
+ src/rpcbind.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/rpcbind.c b/src/rpcbind.c
+index 36a95b9..948a284 100644
+--- a/src/rpcbind.c
++++ b/src/rpcbind.c
+@@ -105,7 +105,7 @@ char *nss_modules = "files";
+ /* who to suid to if -s is given */
+ #define RUN_AS "daemon"
+
+-#define RPCBINDDLOCK "/var/run/rpcbind.lock"
++#define RPCBINDDLOCK RPCBIND_STATEDIR "/rpcbind.lock"
+
+ int runasdaemon = 0;
+ int insecure = 0;
+--
+2.45.2
+
new file mode 100644
@@ -0,0 +1,32 @@
+From 408b18c77c254baaa9111b3e7031ebf12149db38 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <zboszor@gmail.com>
+Date: Fri, 26 Jul 2024 12:54:38 +0200
+Subject: [PATCH 2/2] Run rpcbind.service after /etc/tmpfiles.d is processed
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
+---
+ systemd/rpcbind.service.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
+index f45ee1e..e9d94ce 100644
+--- a/systemd/rpcbind.service.in
++++ b/systemd/rpcbind.service.in
+@@ -9,6 +9,9 @@ RequiresMountsFor=@statedir@
+ Requires=rpcbind.socket
+ Wants=rpcbind.target
+
++# Make sure the runtime directory exists
++After=systemd-tmpfiles-setup.service
++
+ [Service]
+ Type=notify
+ EnvironmentFile=-@_sysconfdir@/rpcbind.conf
+--
+2.45.2
+
new file mode 100644
@@ -0,0 +1 @@
+d /run/rpcbind 0755 root root -
@@ -13,8 +13,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b46486e4c4a416602693a711bb5bfa39 \
SRC_URI = "${SOURCEFORGE_MIRROR}/rpcbind/rpcbind-${PV}.tar.bz2 \
file://init.d \
file://rpcbind.conf \
+ file://rpcbind.tmpfiles \
file://rpcbind_add_option_to_fix_port_number.patch \
file://0001-systemd-use-EnvironmentFile.patch \
+ file://0001-Make-the-lockfile-follow-with-statedir.patch \
+ file://0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch \
"
SRC_URI[sha256sum] = "5613746489cae5ae23a443bb85c05a11741a5f12c8f55d2bb5e83b9defeee8de"
@@ -49,6 +52,9 @@ do_install:append () {
${UNPACKDIR}/init.d > ${D}${sysconfdir}/init.d/rpcbind
chmod 0755 ${D}${sysconfdir}/init.d/rpcbind
install -m 0644 ${UNPACKDIR}/rpcbind.conf ${D}${sysconfdir}/rpcbind.conf
+
+ install -d ${D}${sysconfdir}/tmpfiles.d
+ install -m 0644 ${UNPACKDIR}/rpcbind.tmpfiles ${D}${sysconfdir}/tmpfiles.d/rpcbind.conf
}
ALTERNATIVE:${PN} = "rpcinfo"
With commits 90bc1810 ("bitbake.conf: Add runtimedir") and 561e853e ("rpcbind: Specify state directory under /run") rpcbind still can fail during startup. It has two problems: * The lockfile is still hardcoded as "/var/run/rpcbind.lock". It needs to use the same internal define for RPCBIND_STATEDIR as the paths for rpcbind.xdr and portmap.xdr. * Using --with-statedir=/run/rpcbind doesn't guarantee that this directory exists when rpcbind.service starts. Add this guarantee by running rpcbind.service with After=systemd-tmpfiles-setup.service and add the tmpfiles.d entry for /run/rpcbind. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> --- v2: Superficially fix the Upstream-Status: lines in the patches ...ke-the-lockfile-follow-with-statedir.patch | 31 ++++++++++++++++++ ...ice-after-etc-tmpfiles.d-is-processe.patch | 32 +++++++++++++++++++ .../rpcbind/rpcbind/rpcbind.tmpfiles | 1 + .../recipes-extended/rpcbind/rpcbind_1.2.6.bb | 6 ++++ 4 files changed, 70 insertions(+) create mode 100644 meta/recipes-extended/rpcbind/rpcbind/0001-Make-the-lockfile-follow-with-statedir.patch create mode 100644 meta/recipes-extended/rpcbind/rpcbind/0002-Run-rpcbind.service-after-etc-tmpfiles.d-is-processe.patch create mode 100644 meta/recipes-extended/rpcbind/rpcbind/rpcbind.tmpfiles