diff -up nfs-utils-2.2.1/configure.ac.orig nfs-utils-2.2.1/configure.ac --- nfs-utils-2.2.1/configure.ac.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/configure.ac 2017-10-25 15:52:43.287511759 -0400 @@ -552,6 +552,11 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) # Make sure that $ACLOCAL_FLAGS are used during a rebuild AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"]) +# make libexecdir available for substituion in config files +# 2 "evals" needed late to expand variable names. +AC_SUBST([_libexecdir]) +AC_CONFIG_COMMANDS_PRE([eval eval _libexecdir=$libexecdir]) + # make _sysconfdir available for substituion in config files # 2 "evals" needed late to expand variable names. AC_SUBST([_sysconfdir]) @@ -559,6 +564,7 @@ AC_CONFIG_COMMANDS_PRE([eval eval _sysco AC_CONFIG_FILES([ Makefile + systemd/nfs-config.service systemd/rpc-gssd.service linux-nfs/Makefile support/Makefile diff -up nfs-utils-2.2.1/systemd/Makefile.am.orig nfs-utils-2.2.1/systemd/Makefile.am --- nfs-utils-2.2.1/systemd/Makefile.am.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/Makefile.am 2017-10-25 15:52:43.287511759 -0400 @@ -6,6 +6,7 @@ unit_files = \ nfs-client.target \ rpc_pipefs.target \ \ + nfs-config.service \ nfs-mountd.service \ nfs-server.service \ nfs-utils.service \ diff -up nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig nfs-utils-2.2.1/systemd/nfs-blkmap.service --- nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/nfs-blkmap.service 2017-10-25 15:52:43.288511762 -0400 @@ -10,7 +10,8 @@ PartOf=nfs-utils.service [Service] Type=forking PIDFile=/var/run/blkmapd.pid -ExecStart=/usr/sbin/blkmapd +EnvironmentFile=-/run/sysconfig/nfs-utils +ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS [Install] WantedBy=nfs-client.target diff -up nfs-utils-2.2.1/systemd/nfs-config.service.in.orig nfs-utils-2.2.1/systemd/nfs-config.service.in --- nfs-utils-2.2.1/systemd/nfs-config.service.in.orig 2017-10-25 15:52:43.288511762 -0400 +++ nfs-utils-2.2.1/systemd/nfs-config.service.in 2017-10-25 15:52:43.288511762 -0400 @@ -0,0 +1,13 @@ +[Unit] +Description=Preprocess NFS configuration +After=local-fs.target +DefaultDependencies=no + +[Service] +Type=oneshot +# This service needs to run any time any nfs service +# is started, so changes to local config files get +# incorporated. Having "RemainAfterExit=no" (the default) +# ensures this happens. +RemainAfterExit=no +ExecStart=@_libexecdir@/nfs-utils/nfs-utils_env.sh diff -up nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig nfs-utils-2.2.1/systemd/nfs-idmapd.service --- nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/nfs-idmapd.service 2017-10-25 15:52:43.288511762 -0400 @@ -6,6 +6,10 @@ After=rpc_pipefs.target local-fs.target BindsTo=nfs-server.service +Wants=nfs-config.service +After=nfs-config.service + [Service] +EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking -ExecStart=/usr/sbin/rpc.idmapd +ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS diff -up nfs-utils-2.2.1/systemd/nfs-mountd.service.orig nfs-utils-2.2.1/systemd/nfs-mountd.service --- nfs-utils-2.2.1/systemd/nfs-mountd.service.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/nfs-mountd.service 2017-10-25 15:52:43.289511766 -0400 @@ -8,6 +8,10 @@ After=network-online.target local-fs.tar After=rpcbind.socket BindsTo=nfs-server.service +Wants=nfs-config.service +After=nfs-config.service + [Service] +EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking -ExecStart=/usr/sbin/rpc.mountd +ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS diff -up nfs-utils-2.2.1/systemd/nfs-server.service.orig nfs-utils-2.2.1/systemd/nfs-server.service --- nfs-utils-2.2.1/systemd/nfs-server.service.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/nfs-server.service 2017-10-25 15:52:43.289511766 -0400 @@ -16,11 +16,16 @@ Before= rpc-statd-notify.service Wants=auth-rpcgss-module.service After=rpc-gssd.service gssproxy.service rpc-svcgssd.service +Wants=nfs-config.service +After=nfs-config.service + [Service] +EnvironmentFile=-/run/sysconfig/nfs-utils + Type=oneshot RemainAfterExit=yes ExecStartPre=/usr/sbin/exportfs -r -ExecStart=/usr/sbin/rpc.nfsd +ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS ExecStop=/usr/sbin/rpc.nfsd 0 ExecStopPost=/usr/sbin/exportfs -au ExecStopPost=/usr/sbin/exportfs -f diff -up nfs-utils-2.2.1/systemd/README.orig nfs-utils-2.2.1/systemd/README --- nfs-utils-2.2.1/systemd/README.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/README 2017-10-25 15:52:43.289511766 -0400 @@ -19,8 +19,8 @@ by a suitable 'preset' setting: can work (if no type is given, ".service" is assumed). nfs-client.target - If enabled, daemons needed for an nfs client are enabled. - This does *not* include rpc.statd. The rpc-statd.service unit + If enabled, daemons needs for an nfs client are enabled. + This does *not* include rpc.statd. the rpc-statd.service unit is started by /usr/sbin/start-statd which mount.nfs will run if statd is needed. @@ -52,19 +52,11 @@ It cannot stop rpc.statd or rpc.gssd as client and systemd cannot specify is two-pronged reverse dependency. (i.e. stop this unit if none of these units are running) -Distro specific configuration can be included in /etc/nfs.conf, or -by providing drop-in files which replace the ExecStart line for a given -service, and possibly add an EnvironmentFile line. - -For example, if systemd/system/nfs-mountd.service.d/local.conf -contained - [Service] - EnvironmentFile=/etc/sysconfig/nfs - ExecStart= - ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS - -then the setting of RPCMOUNTDOPTS in /etc/sysconfig/nfs would be -passed to rpc.mountd. +Distro specific commandline configuration can be provided by +installing a script /usr/libexec/nfs-utils/nfs-utils_env.sh +This should write /run/sysconfig/nfs-utils based on configuration +information such as in /etc/sysconfig/nfs or /etc/defaults/nfs. +It is run once by nfs-config.service. rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab is present. diff -up nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig nfs-utils-2.2.1/systemd/rpc-gssd.service.in --- nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/rpc-gssd.service.in 2017-10-25 15:52:43.290511769 -0400 @@ -9,6 +9,11 @@ ConditionPathExists=@_sysconfdir@/krb5.k PartOf=nfs-utils.service +Wants=nfs-config.service +After=nfs-config.service + [Service] +EnvironmentFile=-/run/sysconfig/nfs-utils + Type=forking -ExecStart=/usr/sbin/rpc.gssd +ExecStart=/usr/sbin/rpc.gssd $RPCGSSDARGS diff -up nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig nfs-utils-2.2.1/systemd/rpc-statd-notify.service --- nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig 2017-10-25 15:52:43.290511769 -0400 +++ nfs-utils-2.2.1/systemd/rpc-statd-notify.service 2017-10-25 15:56:28.102284921 -0400 @@ -10,7 +10,11 @@ After=nfs-server.service PartOf=nfs-utils.service +Wants=nfs-config.service +After=nfs-config.service + [Service] Type=forking -ExecStart=-/usr/sbin/sm-notify +EnvironmentFile=-/run/sysconfig/nfs-utils +ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS RemainAfterExit=yes diff -up nfs-utils-2.2.1/systemd/rpc-statd.service.orig nfs-utils-2.2.1/systemd/rpc-statd.service --- nfs-utils-2.2.1/systemd/rpc-statd.service.orig 2017-10-25 15:32:19.000000000 -0400 +++ nfs-utils-2.2.1/systemd/rpc-statd.service 2017-10-25 15:52:43.291511772 -0400 @@ -8,8 +8,12 @@ After=network-online.target nss-lookup.t PartOf=nfs-utils.service +Wants=nfs-config.service +After=nfs-config.service + [Service] Environment=RPC_STATD_NO_NOTIFY=1 +EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking PIDFile=/var/run/rpc.statd.pid -ExecStart=/usr/sbin/rpc.statd +ExecStart=/usr/sbin/rpc.statd $STATDARGS