From patchwork Thu Nov 3 00:22:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9410025 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 7A82A6022E for ; Thu, 3 Nov 2016 00:23:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A6DA2A6A1 for ; Thu, 3 Nov 2016 00:23:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EC482A6BA; Thu, 3 Nov 2016 00:23:11 +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 ECB182A6A1 for ; Thu, 3 Nov 2016 00:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751671AbcKCAXG (ORCPT ); Wed, 2 Nov 2016 20:23:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:59256 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbcKCAXF (ORCPT ); Wed, 2 Nov 2016 20:23:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B0BBDAC0E; Thu, 3 Nov 2016 00:23:03 +0000 (UTC) From: NeilBrown To: Steve Dickson , Thorsten Kukuk Date: Thu, 03 Nov 2016 11:22:57 +1100 Cc: linux-nfs@vger.kernel.org, libtirpc-devel@lists.sourceforge.net Subject: Re: [Libtirpc-devel] [PATCH - rpcbind] Provide systemd unit files for rpcbind In-Reply-To: References: <87oa2q14yc.fsf@notabene.neil.brown.name> <8c1fa65d-9efc-462a-b6c8-7ed518f0dfe4@RedHat.com> <87r36vq85k.fsf@notabene.neil.brown.name> <20161102134902.GA6446@suse.de> <34b0c398-c77f-41e3-4719-158f2190661c@RedHat.com> <87a8dhr39t.fsf@notabene.neil.brown.name> User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-suse-linux-gnu) Message-ID: <874m3pqun2.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 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 From d2831cd5eceee201b3f002a0b75706bd22ba9b67 Mon Sep 17 00:00:00 2001 From: NeilBrown 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 --- .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