diff mbox

[Libtirpc-devel,-,rpcbind] Provide systemd unit files for rpcbind

Message ID 874m3pqun2.fsf@notabene.neil.brown.name (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown Nov. 3, 2016, 12:22 a.m. UTC
On Thu, Nov 03 2016, Steve Dickson wrote:
> Yes... basically
>  
> -bin_PROGRAMS = rpcbind rpcinfo
> +sbin_PROGRAMS = rpcbind rpcinfo

Maybe

-options like `--bindir=DIR' to specify different values for particular
+options like `--sbindir=DIR' to specify different values for particular

in INSTALL too??
>
> and that seems to work... all this means the rpm spec file
> will have to be tweaked when a new release is made.
>
> All I'll for checking in these systemd file with the comments
> from the systemd people and the bin=>sbin change.
>
> How about a respin?

Attached

Thanks,
NeilBrown

Comments

Steve Dickson Nov. 7, 2016, 7:36 p.m. UTC | #1
On 11/02/2016 08:22 PM, NeilBrown wrote:
> On Thu, Nov 03 2016, Steve Dickson wrote:
>> Yes... basically
>>  
>> -bin_PROGRAMS = rpcbind rpcinfo
>> +sbin_PROGRAMS = rpcbind rpcinfo
> Maybe
>
> -options like `--bindir=DIR' to specify different values for particular
> +options like `--sbindir=DIR' to specify different values for particular
>
> in INSTALL too??
I just left it alone... its been that way for years... Why fix something
that is not broken! ;-)

>> and that seems to work... all this means the rpm spec file
>> will have to be tweaked when a new release is made.
>>
>> All I'll for checking in these systemd file with the comments
>> from the systemd people and the bin=>sbin change.
>>
>> How about a respin?
> Attached
Thank you... Committed!

steved.
>
> Thanks,
> NeilBrown
>

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From d2831cd5eceee201b3f002a0b75706bd22ba9b67 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 12 Oct 2016 16:51:47 +1100
Subject: [PATCH] Provide systemd unit files for rpcbind

To encourage uniformity across distributions, provide
systemd unit files.

If extra arguments are wanted for rpcbind, a drop-in should be used
to set the Environment= or read and EnvironmentFile=

Even though libtirpc and the kernel contact rpcbind via /var/run/rcpbind.sock,
tell systemd to place the socket in /run/rpcbind.sock as systems using
systemd always use /run, and often symlink /var/run to /run.

rpcbind.service pulls in rpcbind.socket so that the listening sockets
chosen there will always be used.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 .gitignore                 |  1 +
 Makefile.am                |  4 ++++
 configure.ac               |  7 ++++++-
 systemd/rpcbind.service.in | 17 +++++++++++++++++
 systemd/rpcbind.socket     | 18 ++++++++++++++++++
 5 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 systemd/rpcbind.service.in
 create mode 100644 systemd/rpcbind.socket

diff --git a/.gitignore b/.gitignore
index 321dff64a57d..a8f1fed2acb6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@  rpcbind
 rpcinfo
 # cscope database files
 cscope.*
+systemd/rpcbind.service
diff --git a/Makefile.am b/Makefile.am
index 486bec020bad..79c0fd63a172 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,6 +50,10 @@  if SYSTEMD
 AM_CPPFLAGS += $(SYSTEMD_CFLAGS) -DSYSTEMD
 
 rpcbind_LDADD += $(SYSTEMD_LIBS)
+
+systemdsystemunit_DATA = \
+	systemd/rpcbind.service \
+	systemd/rpcbind.socket
 endif
 
 rpcinfo_SOURCES =       src/rpcinfo.c
diff --git a/configure.ac b/configure.ac
index af4b74b31c9a..f84921eb27fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,4 +61,9 @@  AC_SEARCH_LIBS([pthread_create], [pthread])
 
 AC_CHECK_HEADERS([nss.h rpcsvc/mount.h])
 
-AC_OUTPUT([Makefile])
+# make sbindir available for substitution in config file
+# 2 "evals" needed to expand variable names
+AC_SUBST([_sbindir])
+AC_CONFIG_COMMANDS_PRE([eval eval _sbindir=$sbindir])
+
+AC_OUTPUT([Makefile systemd/rpcbind.service])
diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in
new file mode 100644
index 000000000000..c173b838bd42
--- /dev/null
+++ b/systemd/rpcbind.service.in
@@ -0,0 +1,17 @@ 
+[Unit]
+Description=RPC Bind
+Documentation=man:rpcbind(8)
+DefaultDependencies=no
+
+# Make sure we use the IP addresses listed for
+# rpcbind.socket, no matter how this unit is started.
+Wants=rpcbind.socket
+After=rpcbind.socket
+
+[Service]
+Type=notify
+# distro can provide a drop-in adding EnvironmentFile=-/??? if needed.
+ExecStart=@_sbindir@/rpcbind $RPCBIND_OPTIONS -w -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/rpcbind.socket b/systemd/rpcbind.socket
new file mode 100644
index 000000000000..3b1a93694c21
--- /dev/null
+++ b/systemd/rpcbind.socket
@@ -0,0 +1,18 @@ 
+[Unit]
+Description=RPCbind Server Activation Socket
+DefaultDependencies=no
+Wants=rpcbind.target
+Before=rpcbind.target
+
+[Socket]
+ListenStream=/run/rpcbind.sock
+
+# RPC netconfig can't handle ipv6/ipv4 dual sockets
+BindIPv6Only=ipv6-only
+ListenStream=0.0.0.0:111
+ListenDatagram=0.0.0.0:111
+ListenStream=[::]:111
+ListenDatagram=[::]:111
+
+[Install]
+WantedBy=sockets.target
-- 
2.10.1