From patchwork Wed Oct 12 06:01:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9372363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3990860487 for ; Wed, 12 Oct 2016 10:45:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20A5B2948A for ; Wed, 12 Oct 2016 10:45:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14A5D2948D; Wed, 12 Oct 2016 10:45:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B9A129491 for ; Wed, 12 Oct 2016 10:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932484AbcJLKpu (ORCPT ); Wed, 12 Oct 2016 06:45:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:49991 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932284AbcJLKpt (ORCPT ); Wed, 12 Oct 2016 06:45:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 96FD1ABFC; Wed, 12 Oct 2016 06:01:21 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Wed, 12 Oct 2016 17:01:15 +1100 Cc: libtirpc-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org Subject: [PATCH - rpcbind] Provide systemd unit files for rpcbind User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-suse-linux-gnu) Message-ID: <87oa2q14yc.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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= As the "run" directory could be /run or /var/run we RequiresMountsFor both of these. rpcbind.service pulls in rpcbind.socket so that the listening sockets chosen there will always be used. Signed-off-by: NeilBrown --- .gitignore | 1 + Makefile.am | 4 ++++ configure.ac | 7 ++++++- systemd/rpcbind.service.in | 17 +++++++++++++++++ systemd/rpcbind.socket | 19 +++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 systemd/rpcbind.service.in create mode 100644 systemd/rpcbind.socket hi, these are based on the unit files in use a SUSE, though I have made a few "improvements". If anyone has differences in their distros that you think we should have in mainline, I'd love to hear about it. Thanks, NeilBrown 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 5ec8cd66b689..43c27100ceae 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..0892d8246a12 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 bindir available for substitution in config file +# 2 "evals" needed to expand variable names +AC_SUBST([_bindir]) +AC_CONFIG_COMMANDS_PRE([eval eval _bindir=$bindir]) + +AC_OUTPUT([Makefile systemd/rpcbind.service]) diff --git a/systemd/rpcbind.service.in b/systemd/rpcbind.service.in new file mode 100644 index 000000000000..4706b5a77abf --- /dev/null +++ b/systemd/rpcbind.service.in @@ -0,0 +1,17 @@ +[Unit] +Description=RPC Bind +Documentation=man:rpcbind(8) +DefaultDependencies=no +RequiresMountsFor=/var/run /run +# 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=@_bindir@/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..7204c97efa6f --- /dev/null +++ b/systemd/rpcbind.socket @@ -0,0 +1,19 @@ +[Unit] +Description=RPCbind Server Activation Socket +DefaultDependencies=no +RequiresMountsFor=/var/run /run +Wants=rpcbind.target +Before=rpcbind.target + +[Socket] +ListenStream=/var/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