mirror of https://github.com/containers/podman.git
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>
This commit is contained in:
parent
2fcec59445
commit
69b6659960
17
Makefile
17
Makefile
|
|
@ -770,20 +770,29 @@ install.docker-full: install.docker install.docker-docs
|
||||||
|
|
||||||
.PHONY: install.systemd
|
.PHONY: install.systemd
|
||||||
ifneq (,$(findstring systemd,$(BUILDTAGS)))
|
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}
|
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${USERSYSTEMDDIR}
|
||||||
# User services
|
# 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.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/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/system/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/system/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-restart.service ${DESTDIR}${USERSYSTEMDDIR}/podman-restart.service
|
||||||
# System services
|
# 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.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/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.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.service ${DESTDIR}${SYSTEMDDIR}/podman.service
|
||||||
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${SYSTEMDDIR}/podman-restart.service
|
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-restart.service ${DESTDIR}${SYSTEMDDIR}/podman-restart.service
|
||||||
|
rm -f $(PODMAN_UNIT_FILES)
|
||||||
else
|
else
|
||||||
install.systemd:
|
install.systemd:
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -435,7 +435,7 @@ BUILDTAGS=$BUILDTAGS make binaries
|
||||||
%install
|
%install
|
||||||
install -dp %{buildroot}%{_unitdir}
|
install -dp %{buildroot}%{_unitdir}
|
||||||
install -dp %{buildroot}%{_usr}/lib/systemd/user
|
install -dp %{buildroot}%{_usr}/lib/systemd/user
|
||||||
PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \
|
PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDIR=%{_sysconfdir} \
|
||||||
install.bin-nobuild \
|
install.bin-nobuild \
|
||||||
install.remote-nobuild \
|
install.remote-nobuild \
|
||||||
%if %{with doc}
|
%if %{with doc}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ After=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/podman auto-update
|
ExecStart=@@PODMAN@@ auto-update
|
||||||
ExecStartPost=/usr/bin/podman image prune -f
|
ExecStartPost=@@PODMAN@@ image prune -f
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target default.target
|
WantedBy=multi-user.target default.target
|
||||||
|
|
@ -6,7 +6,7 @@ StartLimitIntervalSec=0
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
Environment=LOGGING="--log-level=info"
|
Environment=LOGGING="--log-level=info"
|
||||||
ExecStart=/usr/bin/podman $LOGGING start --all --filter restart-policy=always
|
ExecStart=@@PODMAN@@ $LOGGING start --all --filter restart-policy=always
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
@ -9,7 +9,7 @@ StartLimitIntervalSec=0
|
||||||
Type=exec
|
Type=exec
|
||||||
KillMode=process
|
KillMode=process
|
||||||
Environment=LOGGING="--log-level=info"
|
Environment=LOGGING="--log-level=info"
|
||||||
ExecStart=/usr/bin/podman $LOGGING system service
|
ExecStart=@@PODMAN@@ $LOGGING system service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
Loading…
Reference in New Issue