2015-04-21 17:40:34

by Calvin Walton

[permalink] [raw]
Subject: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

The systemd unit files now include the correct full paths to the
executables when nfs-utils is configured with an alternate value
for e.g. --prefix or --sbindir

Signed-off-by: Calvin Walton <[email protected]>
---
.gitignore | 8 ++++++++
systemd/Makefile.am | 31 ++++++++++++++++--------------
systemd/nfs-blkmap.service | 17 -----------------
systemd/nfs-blkmap.service.in | 17 +++++++++++++++++
systemd/nfs-idmapd.service | 15 ---------------
systemd/nfs-idmapd.service.in | 15 +++++++++++++++
systemd/nfs-mountd.service | 15 ---------------
systemd/nfs-mountd.service.in | 15 +++++++++++++++
systemd/nfs-server.service | 38 -------------------------------------
systemd/nfs-server.service.in | 38 +++++++++++++++++++++++++++++++++++++
systemd/rpc-gssd.service | 19 -------------------
systemd/rpc-gssd.service.in | 19 +++++++++++++++++++
systemd/rpc-statd-notify.service | 19 -------------------
systemd/rpc-statd-notify.service.in | 19 +++++++++++++++++++
systemd/rpc-statd.service | 17 -----------------
systemd/rpc-statd.service.in | 17 +++++++++++++++++
systemd/rpc-svcgssd.service | 20 -------------------
systemd/rpc-svcgssd.service.in | 20 +++++++++++++++++++
18 files changed, 185 insertions(+), 174 deletions(-)
delete mode 100644 systemd/nfs-blkmap.service
create mode 100644 systemd/nfs-blkmap.service.in
delete mode 100644 systemd/nfs-idmapd.service
create mode 100644 systemd/nfs-idmapd.service.in
delete mode 100644 systemd/nfs-mountd.service
create mode 100644 systemd/nfs-mountd.service.in
delete mode 100644 systemd/nfs-server.service
create mode 100644 systemd/nfs-server.service.in
delete mode 100644 systemd/rpc-gssd.service
create mode 100644 systemd/rpc-gssd.service.in
delete mode 100644 systemd/rpc-statd-notify.service
create mode 100644 systemd/rpc-statd-notify.service.in
delete mode 100644 systemd/rpc-statd.service
create mode 100644 systemd/rpc-statd.service.in
delete mode 100644 systemd/rpc-svcgssd.service
create mode 100644 systemd/rpc-svcgssd.service.in

diff --git a/.gitignore b/.gitignore
index 5164637..4776b04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,6 +69,14 @@ tests/nsm_client/nlm_sm_inter_clnt.c
tests/nsm_client/nlm_sm_inter_svc.c
tests/nsm_client/nlm_sm_inter_xdr.c
utils/nfsidmap/nfsidmap
+systemd/nfs-blkmap.service
+systemd/nfs-idmapd.service
+systemd/nfs-mountd.service
+systemd/nfs-server.service
+systemd/rpc-gssd.service
+systemd/rpc-statd-notify.service
+systemd/rpc-statd.service
+systemd/rpc-svcgssd.service
# cscope database files
cscope.*
# generic editor backup et al
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index fbcabb1..ec7e09b 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -2,30 +2,33 @@

MAINTAINERCLEANFILES = Makefile.in

-unit_files = \
+if INSTALL_SYSTEMD
+dist_unit_DATA = \
nfs-client.target \
\
auth-rpcgss-module.service \
- nfs-blkmap.service \
nfs-config.service \
+ nfs-utils.service \
+ \
+ proc-fs-nfsd.mount \
+ var-lib-nfs-rpc_pipefs.mount
+
+unit_DATA = \
+ nfs-blkmap.service \
nfs-idmapd.service \
nfs-mountd.service \
nfs-server.service \
- nfs-utils.service \
rpc-gssd.service \
rpc-statd-notify.service \
rpc-statd.service \
- rpc-svcgssd.service \
- \
- proc-fs-nfsd.mount \
- var-lib-nfs-rpc_pipefs.mount
+ rpc-svcgssd.service

-EXTRA_DIST = $(unit_files)
+CLEANFILES = $(unit_DATA)

-unit_dir = /usr/lib/systemd/system
-
-if INSTALL_SYSTEMD
-install-data-hook: $(unit_files)
- mkdir -p $(DESTDIR)/$(unitdir)
- cp $(unit_files) $(DESTDIR)/$(unitdir)
+EXTRA_DIST = $(unit_DATA:service=.service.in)
endif
+
+SUFFIXES = .service.in .service
+.service.in.service:
+ $(SED) -e 's,[@]sbindir[@],$(sbindir),g' \
+ < $< > $@
diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service
deleted file mode 100644
index ddbf4e9..0000000
--- a/systemd/nfs-blkmap.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=pNFS block layout mapping daemon
-DefaultDependencies=no
-Conflicts=umount.target
-After=var-lib-nfs-rpc_pipefs.mount
-Requires=var-lib-nfs-rpc_pipefs.mount
-
-PartOf=nfs-utils.service
-
-[Service]
-Type=forking
-PIDFile=/var/run/blkmapd.pid
-EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
-
-[Install]
-WantedBy=nfs-client.target
diff --git a/systemd/nfs-blkmap.service.in b/systemd/nfs-blkmap.service.in
new file mode 100644
index 0000000..37e843d
--- /dev/null
+++ b/systemd/nfs-blkmap.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=pNFS block layout mapping daemon
+DefaultDependencies=no
+Conflicts=umount.target
+After=var-lib-nfs-rpc_pipefs.mount
+Requires=var-lib-nfs-rpc_pipefs.mount
+
+PartOf=nfs-utils.service
+
+[Service]
+Type=forking
+PIDFile=/var/run/blkmapd.pid
+EnvironmentFile=-/run/sysconfig/nfs-utils
+ExecStart=@sbindir@/blkmapd $BLKMAPDARGS
+
+[Install]
+WantedBy=nfs-client.target
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
deleted file mode 100644
index df3dd9d..0000000
--- a/systemd/nfs-idmapd.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=NFSv4 ID-name mapping service
-DefaultDependencies=no
-Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount 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 $RPCIDMAPDARGS
diff --git a/systemd/nfs-idmapd.service.in b/systemd/nfs-idmapd.service.in
new file mode 100644
index 0000000..c081cc8
--- /dev/null
+++ b/systemd/nfs-idmapd.service.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=NFSv4 ID-name mapping service
+DefaultDependencies=no
+Requires=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
+
+BindsTo=nfs-server.service
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+Type=forking
+ExecStart=@sbindir@/rpc.idmapd $RPCIDMAPDARGS
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
deleted file mode 100644
index 8a39f3e..0000000
--- a/systemd/nfs-mountd.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=NFS Mount Daemon
-DefaultDependencies=no
-Requires=proc-fs-nfsd.mount
-After=proc-fs-nfsd.mount
-After=network.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.mountd $RPCMOUNTDARGS
diff --git a/systemd/nfs-mountd.service.in b/systemd/nfs-mountd.service.in
new file mode 100644
index 0000000..9b210b4
--- /dev/null
+++ b/systemd/nfs-mountd.service.in
@@ -0,0 +1,15 @@
+[Unit]
+Description=NFS Mount Daemon
+DefaultDependencies=no
+Requires=proc-fs-nfsd.mount
+After=proc-fs-nfsd.mount
+After=network.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=@sbindir@/rpc.mountd $RPCMOUNTDARGS
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
deleted file mode 100644
index db801cb..0000000
--- a/systemd/nfs-server.service
+++ /dev/null
@@ -1,38 +0,0 @@
-[Unit]
-Description=NFS server and services
-DefaultDependencies=no
-Requires= network.target proc-fs-nfsd.mount rpcbind.target
-Requires= nfs-mountd.service
-Wants=rpc-statd.service nfs-idmapd.service
-Wants=rpc-statd-notify.service
-
-After= local-fs.target
-After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
-After= nfs-idmapd.service rpc-statd.service
-Before= rpc-statd-notify.service
-
-# GSS services dependencies and ordering
-Wants=auth-rpcgss-module.service
-After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
-
-# start/stop server before/after client
-Before=remote-fs-pre.target
-
-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 $RPCNFSDARGS
-ExecStop=/usr/sbin/rpc.nfsd 0
-ExecStopPost=/usr/sbin/exportfs -au
-ExecStopPost=/usr/sbin/exportfs -f
-
-ExecReload=/usr/sbin/exportfs -r
-
-[Install]
-WantedBy=multi-user.target
diff --git a/systemd/nfs-server.service.in b/systemd/nfs-server.service.in
new file mode 100644
index 0000000..24239ce
--- /dev/null
+++ b/systemd/nfs-server.service.in
@@ -0,0 +1,38 @@
+[Unit]
+Description=NFS server and services
+DefaultDependencies=no
+Requires= network.target proc-fs-nfsd.mount rpcbind.target
+Requires= nfs-mountd.service
+Wants=rpc-statd.service nfs-idmapd.service
+Wants=rpc-statd-notify.service
+
+After= local-fs.target
+After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
+After= nfs-idmapd.service rpc-statd.service
+Before= rpc-statd-notify.service
+
+# GSS services dependencies and ordering
+Wants=auth-rpcgss-module.service
+After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
+
+# start/stop server before/after client
+Before=remote-fs-pre.target
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
+Type=oneshot
+RemainAfterExit=yes
+ExecStartPre=@sbindir@/exportfs -r
+ExecStart=@sbindir@/rpc.nfsd $RPCNFSDARGS
+ExecStop=@sbindir@/rpc.nfsd 0
+ExecStopPost=@sbindir@/exportfs -au
+ExecStopPost=@sbindir@/exportfs -f
+
+ExecReload=@sbindir@/exportfs -r
+
+[Install]
+WantedBy=multi-user.target
diff --git a/systemd/rpc-gssd.service b/systemd/rpc-gssd.service
deleted file mode 100644
index d4a3819..0000000
--- a/systemd/rpc-gssd.service
+++ /dev/null
@@ -1,19 +0,0 @@
-[Unit]
-Description=RPC security service for NFS client and server
-DefaultDependencies=no
-Conflicts=umount.target
-Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount
-
-ConditionPathExists=/etc/krb5.keytab
-
-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 $GSSDARGS
diff --git a/systemd/rpc-gssd.service.in b/systemd/rpc-gssd.service.in
new file mode 100644
index 0000000..52b2ce9
--- /dev/null
+++ b/systemd/rpc-gssd.service.in
@@ -0,0 +1,19 @@
+[Unit]
+Description=RPC security service for NFS client and server
+DefaultDependencies=no
+Conflicts=umount.target
+Requires=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount
+
+ConditionPathExists=/etc/krb5.keytab
+
+PartOf=nfs-utils.service
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
+Type=forking
+ExecStart=@sbindir@/rpc.gssd $GSSDARGS
diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
deleted file mode 100644
index 89ba36c..0000000
--- a/systemd/rpc-statd-notify.service
+++ /dev/null
@@ -1,19 +0,0 @@
-[Unit]
-Description=Notify NFS peers of a restart
-DefaultDependencies=no
-Requires=network.target
-After=local-fs.target network.target nss-lookup.target
-
-# if we run an nfs server, it needs to be running before we
-# tell clients that it has restarted.
-After=nfs-server.service
-
-PartOf=nfs-utils.service
-
-Wants=nfs-config.service
-After=nfs-config.service
-
-[Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
-Type=forking
-ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
diff --git a/systemd/rpc-statd-notify.service.in b/systemd/rpc-statd-notify.service.in
new file mode 100644
index 0000000..81003ec
--- /dev/null
+++ b/systemd/rpc-statd-notify.service.in
@@ -0,0 +1,19 @@
+[Unit]
+Description=Notify NFS peers of a restart
+DefaultDependencies=no
+Requires=network.target
+After=local-fs.target network.target nss-lookup.target
+
+# if we run an nfs server, it needs to be running before we
+# tell clients that it has restarted.
+After=nfs-server.service
+
+PartOf=nfs-utils.service
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+Type=forking
+ExecStart=-@sbindir@/sm-notify $SMNOTIFYARGS
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
deleted file mode 100644
index 14604d7..0000000
--- a/systemd/rpc-statd.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=NFS status monitor for NFSv2/3 locking.
-DefaultDependencies=no
-Conflicts=umount.target
-Requires=nss-lookup.target rpcbind.target
-After=network.target nss-lookup.target rpcbind.target
-
-PartOf=nfs-utils.service
-
-Wants=nfs-config.service
-After=nfs-config.service
-
-[Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
-Type=forking
-PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
diff --git a/systemd/rpc-statd.service.in b/systemd/rpc-statd.service.in
new file mode 100644
index 0000000..d76032e
--- /dev/null
+++ b/systemd/rpc-statd.service.in
@@ -0,0 +1,17 @@
+[Unit]
+Description=NFS status monitor for NFSv2/3 locking.
+DefaultDependencies=no
+Conflicts=umount.target
+Requires=nss-lookup.target rpcbind.target
+After=network.target nss-lookup.target rpcbind.target
+
+PartOf=nfs-utils.service
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+Type=forking
+PIDFile=/var/run/rpc.statd.pid
+ExecStart=@sbindir@/rpc.statd --no-notify $STATDARGS
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
deleted file mode 100644
index 41177b6..0000000
--- a/systemd/rpc-svcgssd.service
+++ /dev/null
@@ -1,20 +0,0 @@
-[Unit]
-Description=RPC security service for NFS server
-DefaultDependencies=no
-Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount local-fs.target
-PartOf=nfs-server.service
-PartOf=nfs-utils.service
-
-After=gssproxy.service
-ConditionPathExists=|!/run/gssproxy.pid
-ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
-ConditionPathExists=/etc/krb5.keytab
-
-Wants=nfs-config.service
-After=nfs-config.service
-
-[Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
-Type=forking
-ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
diff --git a/systemd/rpc-svcgssd.service.in b/systemd/rpc-svcgssd.service.in
new file mode 100644
index 0000000..cbedc67
--- /dev/null
+++ b/systemd/rpc-svcgssd.service.in
@@ -0,0 +1,20 @@
+[Unit]
+Description=RPC security service for NFS server
+DefaultDependencies=no
+Requires=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
+PartOf=nfs-server.service
+PartOf=nfs-utils.service
+
+After=gssproxy.service
+ConditionPathExists=|!/run/gssproxy.pid
+ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
+ConditionPathExists=/etc/krb5.keytab
+
+Wants=nfs-config.service
+After=nfs-config.service
+
+[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+Type=forking
+ExecStart=@sbindir@/rpc.svcgssd $SVCGSSDARGS
--
2.3.3



2015-04-21 17:43:48

by Calvin Walton

[permalink] [raw]
Subject: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

The systemd unit files now include the correct full paths to the
executables when nfs-utils is configured with an alternate value
for e.g. --prefix or --sbindir

Signed-off-by: Calvin Walton <[email protected]>
---

Resend of the same patch, but this time generated with -M so the diff
includes file moves; this should make it a bit easier to review.

.gitignore | 8 ++++++
systemd/Makefile.am | 31 ++++++++++++----------
.../{nfs-blkmap.service => nfs-blkmap.service.in} | 2 +-
.../{nfs-idmapd.service => nfs-idmapd.service.in} | 2 +-
.../{nfs-mountd.service => nfs-mountd.service.in} | 2 +-
.../{nfs-server.service => nfs-server.service.in} | 12 ++++-----
systemd/{rpc-gssd.service => rpc-gssd.service.in} | 2 +-
...-notify.service => rpc-statd-notify.service.in} | 2 +-
.../{rpc-statd.service => rpc-statd.service.in} | 2 +-
...{rpc-svcgssd.service => rpc-svcgssd.service.in} | 2 +-
10 files changed, 38 insertions(+), 27 deletions(-)
rename systemd/{nfs-blkmap.service => nfs-blkmap.service.in} (88%)
rename systemd/{nfs-idmapd.service => nfs-idmapd.service.in} (86%)
rename systemd/{nfs-mountd.service => nfs-mountd.service.in} (86%)
rename systemd/{nfs-server.service => nfs-server.service.in} (78%)
rename systemd/{rpc-gssd.service => rpc-gssd.service.in} (90%)
rename systemd/{rpc-statd-notify.service => rpc-statd-notify.service.in} (90%)
rename systemd/{rpc-statd.service => rpc-statd.service.in} (87%)
rename systemd/{rpc-svcgssd.service => rpc-svcgssd.service.in} (91%)

diff --git a/.gitignore b/.gitignore
index 5164637..4776b04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,6 +69,14 @@ tests/nsm_client/nlm_sm_inter_clnt.c
tests/nsm_client/nlm_sm_inter_svc.c
tests/nsm_client/nlm_sm_inter_xdr.c
utils/nfsidmap/nfsidmap
+systemd/nfs-blkmap.service
+systemd/nfs-idmapd.service
+systemd/nfs-mountd.service
+systemd/nfs-server.service
+systemd/rpc-gssd.service
+systemd/rpc-statd-notify.service
+systemd/rpc-statd.service
+systemd/rpc-svcgssd.service
# cscope database files
cscope.*
# generic editor backup et al
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index fbcabb1..ec7e09b 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -2,30 +2,33 @@

MAINTAINERCLEANFILES = Makefile.in

-unit_files = \
+if INSTALL_SYSTEMD
+dist_unit_DATA = \
nfs-client.target \
\
auth-rpcgss-module.service \
- nfs-blkmap.service \
nfs-config.service \
+ nfs-utils.service \
+ \
+ proc-fs-nfsd.mount \
+ var-lib-nfs-rpc_pipefs.mount
+
+unit_DATA = \
+ nfs-blkmap.service \
nfs-idmapd.service \
nfs-mountd.service \
nfs-server.service \
- nfs-utils.service \
rpc-gssd.service \
rpc-statd-notify.service \
rpc-statd.service \
- rpc-svcgssd.service \
- \
- proc-fs-nfsd.mount \
- var-lib-nfs-rpc_pipefs.mount
+ rpc-svcgssd.service

-EXTRA_DIST = $(unit_files)
+CLEANFILES = $(unit_DATA)

-unit_dir = /usr/lib/systemd/system
-
-if INSTALL_SYSTEMD
-install-data-hook: $(unit_files)
- mkdir -p $(DESTDIR)/$(unitdir)
- cp $(unit_files) $(DESTDIR)/$(unitdir)
+EXTRA_DIST = $(unit_DATA:service=.service.in)
endif
+
+SUFFIXES = .service.in .service
+.service.in.service:
+ $(SED) -e 's,[@]sbindir[@],$(sbindir),g' \
+ < $< > $@
diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service.in
similarity index 88%
rename from systemd/nfs-blkmap.service
rename to systemd/nfs-blkmap.service.in
index ddbf4e9..37e843d 100644
--- a/systemd/nfs-blkmap.service
+++ b/systemd/nfs-blkmap.service.in
@@ -11,7 +11,7 @@ PartOf=nfs-utils.service
Type=forking
PIDFile=/var/run/blkmapd.pid
EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
+ExecStart=@sbindir@/blkmapd $BLKMAPDARGS

[Install]
WantedBy=nfs-client.target
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service.in
similarity index 86%
rename from systemd/nfs-idmapd.service
rename to systemd/nfs-idmapd.service.in
index df3dd9d..c081cc8 100644
--- a/systemd/nfs-idmapd.service
+++ b/systemd/nfs-idmapd.service.in
@@ -12,4 +12,4 @@ After=nfs-config.service
[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
+ExecStart=@sbindir@/rpc.idmapd $RPCIDMAPDARGS
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service.in
similarity index 86%
rename from systemd/nfs-mountd.service
rename to systemd/nfs-mountd.service.in
index 8a39f3e..9b210b4 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service.in
@@ -12,4 +12,4 @@ After=nfs-config.service
[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
+ExecStart=@sbindir@/rpc.mountd $RPCMOUNTDARGS
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service.in
similarity index 78%
rename from systemd/nfs-server.service
rename to systemd/nfs-server.service.in
index db801cb..24239ce 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service.in
@@ -26,13 +26,13 @@ EnvironmentFile=-/run/sysconfig/nfs-utils

Type=oneshot
RemainAfterExit=yes
-ExecStartPre=/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
-ExecStop=/usr/sbin/rpc.nfsd 0
-ExecStopPost=/usr/sbin/exportfs -au
-ExecStopPost=/usr/sbin/exportfs -f
+ExecStartPre=@sbindir@/exportfs -r
+ExecStart=@sbindir@/rpc.nfsd $RPCNFSDARGS
+ExecStop=@sbindir@/rpc.nfsd 0
+ExecStopPost=@sbindir@/exportfs -au
+ExecStopPost=@sbindir@/exportfs -f

-ExecReload=/usr/sbin/exportfs -r
+ExecReload=@sbindir@/exportfs -r

[Install]
WantedBy=multi-user.target
diff --git a/systemd/rpc-gssd.service b/systemd/rpc-gssd.service.in
similarity index 90%
rename from systemd/rpc-gssd.service
rename to systemd/rpc-gssd.service.in
index d4a3819..52b2ce9 100644
--- a/systemd/rpc-gssd.service
+++ b/systemd/rpc-gssd.service.in
@@ -16,4 +16,4 @@ After=nfs-config.service
EnvironmentFile=-/run/sysconfig/nfs-utils

Type=forking
-ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
+ExecStart=@sbindir@/rpc.gssd $GSSDARGS
diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service.in
similarity index 90%
rename from systemd/rpc-statd-notify.service
rename to systemd/rpc-statd-notify.service.in
index 89ba36c..81003ec 100644
--- a/systemd/rpc-statd-notify.service
+++ b/systemd/rpc-statd-notify.service.in
@@ -16,4 +16,4 @@ After=nfs-config.service
[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
+ExecStart=-@sbindir@/sm-notify $SMNOTIFYARGS
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service.in
similarity index 87%
rename from systemd/rpc-statd.service
rename to systemd/rpc-statd.service.in
index 14604d7..d76032e 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service.in
@@ -14,4 +14,4 @@ After=nfs-config.service
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
+ExecStart=@sbindir@/rpc.statd --no-notify $STATDARGS
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service.in
similarity index 91%
rename from systemd/rpc-svcgssd.service
rename to systemd/rpc-svcgssd.service.in
index 41177b6..cbedc67 100644
--- a/systemd/rpc-svcgssd.service
+++ b/systemd/rpc-svcgssd.service.in
@@ -17,4 +17,4 @@ After=nfs-config.service
[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
+ExecStart=@sbindir@/rpc.svcgssd $SVCGSSDARGS
--
2.3.3


2015-05-06 20:28:55

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.



On 04/21/2015 01:40 PM, Calvin Walton wrote:
> The systemd unit files now include the correct full paths to the
> executables when nfs-utils is configured with an alternate value
> for e.g. --prefix or --sbindir
>
> Signed-off-by: Calvin Walton <[email protected]>
This kind of major change always makes me a bit nervous and
unfortunately I'm not going to have the cycles to give
it the testing I would like because I'm going on holiday
all next week...

I'll keep it on my TODO list because it sound like it makes
sense... but probably will not get to it for a couple weeks.

Also, would you mind breaking the patch up to show what you
are doing to each script? It would make it a lot easier
to review...

steved.


2015-05-06 20:39:15

by Calvin Walton

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

On Wed, 2015-05-06 at 16:28 -0400, Steve Dickson wrote:
> On 04/21/2015 01:40 PM, Calvin Walton wrote:
> > The systemd unit files now include the correct full paths to the
> > executables when nfs-utils is configured with an alternate value
> > for e.g. --prefix or --sbindir
> >
> > Signed-off-by: Calvin Walton <[email protected]>
> This kind of major change always makes me a bit nervous and
> unfortunately I'm not going to have the cycles to give
> it the testing I would like because I'm going on holiday
> all next week...
>
> I'll keep it on my TODO list because it sound like it makes
> sense... but probably will not get to it for a couple weeks.
>
> Also, would you mind breaking the patch up to show what you
> are doing to each script? It would make it a lot easier
> to review...

I sent the same patch, regenerated with the -M option to git, visible
at:
http://news.gmane.org/find-root.php?message_id=1429638223%2d13852%2d1%2dgit%2dsend%2demail%2dcalvin.walton%40kepstin.ca

This should be a bit more reviewable, because it shows the changes
made to each unit file following the file renames.

If you'd still prefer to have the patch split up, let me know.

--
Calvin Walton <[email protected]>

2015-05-07 13:36:37

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.



On 05/06/2015 04:39 PM, Calvin Walton wrote:
> I sent the same patch, regenerated with the -M option to git, visible
> at:
> http://news.gmane.org/find-root.php?message_id=1429638223%2d13852%2d1%2dgit%2dsend%2demail%2dcalvin.walton%40kepstin.ca
>
I saw this..
> This should be a bit more reviewable, because it shows the changes
> made to each unit file following the file renames.
>
> If you'd still prefer to have the patch split up, let me know.
If you would not mind... It actually a bit more difficult
on my end applying a number of patches verses one, but
it does make it much easier to read...

tia,

steved.

2015-07-14 14:32:14

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

Hello Calivn,

I'm finally getting back to take a look at this...

On 04/21/2015 01:43 PM, Calvin Walton wrote:
> The systemd unit files now include the correct full paths to the
> executables when nfs-utils is configured with an alternate value
> for e.g. --prefix or --sbindir
>
> Signed-off-by: Calvin Walton <[email protected]>
> ---
>
> Resend of the same patch, but this time generated with -M so the diff
> includes file moves; this should make it a bit easier to review.
I see what your are trying to do... Make the systemd scripts
use @sbindir@ instead of a hard coded '/usr/sbin/' which
is fine. To do this you are renaming all the systemd
scripts to .in systemd scripts.

But what I'm missing is what actually generates the
systemd scripts with the correct path names?

Since you took out the install-data-hook: rule from
the Makefile.am file, when I do a make install none
of the scripts get installed....

steved.

2015-07-14 15:22:52

by Calvin Walton

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

On Tue, 2015-07-14 at 10:32 -0400, Steve Dickson wrote:
> Hello Calivn,
>
> I'm finally getting back to take a look at this...
>
> I see what your are trying to do... Make the systemd scripts
> use @sbindir@ instead of a hard coded '/usr/sbin/' which
> is fine. To do this you are renaming all the systemd
> scripts to .in systemd scripts.

Not all of them, there's a few I left untouched because they didn't
need any directory substitutions.

> But what I'm missing is what actually generates the
> systemd scripts with the correct path names?

At the bottom of the systemd/Makefile.am file, a rule is added to
generate a ".service" file from a ".service.in" file, which gets called
automatically by make to generate the files listed in the unit_DATA
variable.

> Since you took out the install-data-hook: rule from
> the Makefile.am file, when I do a make install none
> of the scripts get installed....

Hmm. I took a look at this; the files don't get installed unless you
pass "--with-systemd=/usr/lib/systemd/system" (or the equivalent path
on your system). In particular, using "--with-systemd" with no
parameter won't work, since they'll get installed to the directory
"yes" (i.e. the value of the --with-systemd parameter).

This is the same behaviour as before my patch, but it could be improved
by reworking the configure script a bit (in particular, using pkg
-config to ask for the system default systemd unit directory).

Do you still want the patches split up between the Makefile changes and
each individual modified unit file?

--
Calvin Walton <[email protected]>

2015-07-14 15:36:36

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

Hello,

On 07/14/2015 11:22 AM, Calvin Walton wrote:
> On Tue, 2015-07-14 at 10:32 -0400, Steve Dickson wrote:
>> Hello Calivn,
>>
>> I'm finally getting back to take a look at this...
>>
>> I see what your are trying to do... Make the systemd scripts
>> use @sbindir@ instead of a hard coded '/usr/sbin/' which
>> is fine. To do this you are renaming all the systemd
>> scripts to .in systemd scripts.
>
> Not all of them, there's a few I left untouched because they didn't
> need any directory substitutions.
>
>> But what I'm missing is what actually generates the
>> systemd scripts with the correct path names?
>
> At the bottom of the systemd/Makefile.am file, a rule is added to
> generate a ".service" file from a ".service.in" file, which gets called
> automatically by make to generate the files listed in the unit_DATA
> variable.
>
>> Since you took out the install-data-hook: rule from
>> the Makefile.am file, when I do a make install none
>> of the scripts get installed....
>
> Hmm. I took a look at this; the files don't get installed unless you
> pass "--with-systemd=/usr/lib/systemd/system" (or the equivalent path
> on your system). In particular, using "--with-systemd" with no
> parameter won't work, since they'll get installed to the directory
> "yes" (i.e. the value of the --with-systemd parameter).
I see this... using --with-systemd does get the files created
and installed.

>
> This is the same behaviour as before my patch, but it could be improved
> by reworking the configure script a bit (in particular, using pkg
> -config to ask for the system default systemd unit directory).
It would be nice if the files got created and install by
default (aka not having to specify --with-systemd) and
not created/install when --without-systemd is used (which
does happen now).

>
> Do you still want the patches split up between the Makefile changes and
> each individual modified unit file?
>
No I'm good... just fix the default part and re-post...

tia!

steved

2015-11-02 12:53:41

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

Hello,

I'm finally getting around to looking at this and
I'm seen a couple issues...

On 04/21/2015 01:43 PM, Calvin Walton wrote:
> The systemd unit files now include the correct full paths to the
> executables when nfs-utils is configured with an alternate value
> for e.g. --prefix or --sbindir
>
> Signed-off-by: Calvin Walton <[email protected]>
> ---
>
> Resend of the same patch, but this time generated with -M so the diff
> includes file moves; this should make it a bit easier to review.
>
> .gitignore | 8 ++++++
> systemd/Makefile.am | 31 ++++++++++++----------
> .../{nfs-blkmap.service => nfs-blkmap.service.in} | 2 +-
> .../{nfs-idmapd.service => nfs-idmapd.service.in} | 2 +-
> .../{nfs-mountd.service => nfs-mountd.service.in} | 2 +-
> .../{nfs-server.service => nfs-server.service.in} | 12 ++++-----
> systemd/{rpc-gssd.service => rpc-gssd.service.in} | 2 +-
> ...-notify.service => rpc-statd-notify.service.in} | 2 +-
> .../{rpc-statd.service => rpc-statd.service.in} | 2 +-
> ...{rpc-svcgssd.service => rpc-svcgssd.service.in} | 2 +-
> 10 files changed, 38 insertions(+), 27 deletions(-)
> rename systemd/{nfs-blkmap.service => nfs-blkmap.service.in} (88%)
> rename systemd/{nfs-idmapd.service => nfs-idmapd.service.in} (86%)
> rename systemd/{nfs-mountd.service => nfs-mountd.service.in} (86%)
> rename systemd/{nfs-server.service => nfs-server.service.in} (78%)
> rename systemd/{rpc-gssd.service => rpc-gssd.service.in} (90%)
> rename systemd/{rpc-statd-notify.service => rpc-statd-notify.service.in} (90%)
> rename systemd/{rpc-statd.service => rpc-statd.service.in} (87%)
> rename systemd/{rpc-svcgssd.service => rpc-svcgssd.service.in} (91%)
>
> diff --git a/.gitignore b/.gitignore
> index 5164637..4776b04 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -69,6 +69,14 @@ tests/nsm_client/nlm_sm_inter_clnt.c
> tests/nsm_client/nlm_sm_inter_svc.c
> tests/nsm_client/nlm_sm_inter_xdr.c
> utils/nfsidmap/nfsidmap
> +systemd/nfs-blkmap.service
> +systemd/nfs-idmapd.service
> +systemd/nfs-mountd.service
> +systemd/nfs-server.service
> +systemd/rpc-gssd.service
> +systemd/rpc-statd-notify.service
> +systemd/rpc-statd.service
> +systemd/rpc-svcgssd.service
> # cscope database files
> cscope.*
> # generic editor backup et al
> diff --git a/systemd/Makefile.am b/systemd/Makefile.am
> index fbcabb1..ec7e09b 100644
> --- a/systemd/Makefile.am
> +++ b/systemd/Makefile.am
> @@ -2,30 +2,33 @@
>
> MAINTAINERCLEANFILES = Makefile.in
>
> -unit_files = \
> +if INSTALL_SYSTEMD
> +dist_unit_DATA = \
> nfs-client.target \
> \
> auth-rpcgss-module.service \
> - nfs-blkmap.service \
> nfs-config.service \
> + nfs-utils.service \
> + \
> + proc-fs-nfsd.mount \
> + var-lib-nfs-rpc_pipefs.mount
> +
> +unit_DATA = \
> + nfs-blkmap.service \
> nfs-idmapd.service \
> nfs-mountd.service \
> nfs-server.service \
> - nfs-utils.service \
> rpc-gssd.service \
> rpc-statd-notify.service \
> rpc-statd.service \
> - rpc-svcgssd.service \
> - \
> - proc-fs-nfsd.mount \
> - var-lib-nfs-rpc_pipefs.mount
> + rpc-svcgssd.service
>
> -EXTRA_DIST = $(unit_files)
> +CLEANFILES = $(unit_DATA)
This beginning part of the patch no longer applies
which is my fault... :-(
>
> -unit_dir = /usr/lib/systemd/system
> -
> -if INSTALL_SYSTEMD
> -install-data-hook: $(unit_files)
But after making the patch apply cleanly the scripts
no longer get installed and I believe its
because you took out the above rule.

> - mkdir -p $(DESTDIR)/$(unitdir)
> - cp $(unit_files) $(DESTDIR)/$(unitdir)
> +EXTRA_DIST = $(unit_DATA:service=.service.in)
> endif
> +
> +SUFFIXES = .service.in .service
> +.service.in.service:
> + $(SED) -e 's,[@]sbindir[@],$(sbindir),g' \
> + < $< > $@

The rest of the patches all applied cleanly

steved.

2015-11-02 13:23:54

by Calvin Walton

[permalink] [raw]
Subject: Re: [PATCH] nfs-utils: Substitute sbindir in systemd unit files.

Hi Steve,

On Mon, 2015-11-02 at 07:53 -0500, Steve Dickson wrote:
> Hello,
>
> I'm finally getting around to looking at this and
> I'm seen a couple issues...

> > -unit_dir = /usr/lib/systemd/system
> > -
> > -if INSTALL_SYSTEMD
> > -install-data-hook: $(unit_files)
> But after making the patch apply cleanly the scripts
> no longer get installed and I believe its
> because you took out the above rule.

You had actually ran into this same issue when you reviewed the patch
earlier. This rule isn't needed because automake's built-in install
path functionality is used - but the files only get installed if
  --with-systemd=/some/path
is passed to configure. (If you only use --with-systemd, you might find
the units get installed to the directory "/yes")

The conclusion was that some patching of configure was needed - it
should enable installing the unit files by default if systemd is found,
and not require manually specifying the path where to install the units
(using e.g. pkg-config to find it if unspecified)

I should have done this earlier, but was busy with some other stuff for
work.

I'm ok with autoconf stuff, so I'll take a look at rolling an updated
patch series with the configure changes. Hopefully it'll get done
before several months have passed...

--
Calvin Walton <[email protected]>