Skip to content

Commit

Permalink
Merge pull request #16892 from alexlarsson/transient-clean-unit
Browse files Browse the repository at this point in the history
Add podman-clean-transient.service service
  • Loading branch information
openshift-merge-robot authored Dec 20, 2022
2 parents 5f4d7b5 + ddeb959 commit c2d48c5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ ifneq (,$(findstring systemd,$(BUILDTAGS)))
PODMAN_UNIT_FILES = contrib/systemd/auto-update/podman-auto-update.service \
contrib/systemd/system/podman.service \
contrib/systemd/system/podman-restart.service \
contrib/systemd/system/[email protected]
contrib/systemd/system/[email protected] \
contrib/systemd/system/podman-clean-transient.service

%.service: %.service.in
sed -e 's;@@PODMAN@@;$(BINDIR)/podman;g' $< >$@.tmp.$$ \
Expand All @@ -893,6 +894,7 @@ install.systemd: $(PODMAN_UNIT_FILES)
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/[email protected] ${DESTDIR}${SYSTEMDDIR}/[email protected]
install ${SELINUXOPT} -m 644 contrib/systemd/system/podman-clean-transient.service ${DESTDIR}${SYSTEMDDIR}/podman-clean-transient.service
rm -f $(PODMAN_UNIT_FILES)
else
install.systemd:
Expand Down
21 changes: 21 additions & 0 deletions contrib/systemd/system/podman-clean-transient.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This service runs once each boot to remove potential leftover
# container state from previous boots.

# This is needed when using transient storage mode in podman where the
# database and other configs are stored in tmpfs, but some other files
# are not. If we don't run this after an unclean boot then there may
# be some leftover files that grow over time.

[Unit]
Description=Clean up podman transient data
RequiresMountsFor=%t/containers
Documentation=man:podman-system-prune(1)
Requires=boot-complete.target
After=local-fs.target boot-complete.target

[Service]
Type=oneshot
ExecStart=@@PODMAN@@ system prune --external

[Install]
WantedBy=default.target
1 change: 1 addition & 0 deletions podman.spec.rpkg
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ fi
%{_unitdir}/%{name}.socket
%{_unitdir}/%{name}-restart.service
%{_unitdir}/%{name}[email protected]
%{_unitdir}/%{name}-clean-transient.service
%{_userunitdir}/%{name}-auto-update.service
%{_userunitdir}/%{name}-auto-update.timer
%{_userunitdir}/%{name}.service
Expand Down

0 comments on commit c2d48c5

Please sign in to comment.