summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-10-07 08:10:41 -0600
committerEd Santiago <santiago@redhat.com>2021-10-12 07:57:26 -0600
commit69b66599609c6513de8d72c45fe327312b0b81ac (patch)
tree0b853ab073495cd8f779da80250cc716b90c54f4 /Makefile
parent2fcec59445267e8c8e06005539701a172d3db8a5 (diff)
downloadpodman-69b66599609c6513de8d72c45fe327312b0b81ac.tar.gz
podman-69b66599609c6513de8d72c45fe327312b0b81ac.tar.bz2
podman-69b66599609c6513de8d72c45fe327312b0b81ac.zip
Unit files: Use actual installed path for podman
Don't hardcode /usr/bin/podman in unit files: instead, use template files with a path replaced at install time. Because 'make' can be invoked repeatedly, with different PREFIX, do not leave the generated files behind in our work directory: wipe them immediately after install. To get this to work, fix a longstanding bug in podman.spec.in, a PREFIX that should've been DESTDIR. Side note: #7023 made contrib/systemd/user a symlink to .../system but did not update paths in Makefile. The unrelated-looking path change you see here is a belated correction for that. Fixes: #10787 Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 13 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 590675d25..8af9cfd1b 100644
--- a/Makefile
+++ b/Makefile
@@ -770,20 +770,29 @@ install.docker-full: install.docker install.docker-docs
.PHONY: install.systemd
ifneq (,$(findstring systemd,$(BUILDTAGS)))
-install.systemd:
+PODMAN_UNIT_FILES = contrib/systemd/auto-update/podman-auto-update.service \
+ contrib/systemd/system/podman.service \
+ contrib/systemd/system/podman-restart.service
+
+%.service: %.service.in
+ sed -e 's;@@PODMAN@@;$(BINDIR)/podman;g' $< >$@.tmp.$$ \
+ && mv -f $@.tmp.$$ $@
+
+install.systemd: $(PODMAN_UNIT_FILES)
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${USERSYSTEMDDIR}
# User services
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service ${DESTDIR}${USERSYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer ${DESTDIR}${USERSYSTEMDDIR}/podman-auto-update.timer
- install ${SELINUXOPT} -m 644 contrib/systemd/user/podman.socket ${DESTDIR}${USERSYSTEMDDIR}/podman.socket
- install ${SELINUXOPT} -m 644 contrib/systemd/user/podman.service ${DESTDIR}${USERSYSTEMDDIR}/podman.service
- install ${SELINUXOPT} -m 644 contrib/systemd/user/podman-restart.service ${DESTDIR}${USERSYSTEMDDIR}/podman-restart.service
+ install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket ${DESTDIR}${USERSYSTEMDDIR}/podman.socket
+ install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service ${DESTDIR}${USERSYSTEMDDIR}/podman.service
+ install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${USERSYSTEMDDIR}/podman-restart.service
# System services
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.service ${DESTDIR}${SYSTEMDDIR}/podman-auto-update.service
install ${SELINUXOPT} -m 644 contrib/systemd/auto-update/podman-auto-update.timer ${DESTDIR}${SYSTEMDDIR}/podman-auto-update.timer
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.socket ${DESTDIR}${SYSTEMDDIR}/podman.socket
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman.service ${DESTDIR}${SYSTEMDDIR}/podman.service
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${SYSTEMDDIR}/podman-restart.service
+ rm -f $(PODMAN_UNIT_FILES)
else
install.systemd:
endif