1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 06:45:31 +01:00

add new podman-user-wait-network-online.service

This service is meant to be used by quadlet as replacement for
network-online.target as this does not work for rootless users.

see #22197

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-10-17 14:27:10 +02:00
parent a6c4e00e9a
commit 203ab6573b
3 changed files with 16 additions and 1 deletions

2
.gitignore vendored
View File

@@ -4,7 +4,7 @@
/build/
/conmon/
contrib/spec/podman.spec
contrib/systemd/*/*.service
contrib/systemd/system/*.service
*.coverprofile
coverprofile
/.coverage

View File

@@ -1000,6 +1000,9 @@ install.systemd: $(PODMAN_GENERATED_UNIT_FILES)
install ${SELINUXOPT} -m 644 $$unit $(DESTDIR)${USERSYSTEMDDIR}/$$(basename $$unit); \
install ${SELINUXOPT} -m 644 $$unit $(DESTDIR)${SYSTEMDDIR}/$$(basename $$unit); \
done
# Important this unit should only be installed for the user session and is thus not added to the loop above.
install ${SELINUXOPT} -m 644 contrib/systemd/user/podman-user-wait-network-online.service \
$(DESTDIR)${USERSYSTEMDDIR}/podman-user-wait-network-online.service
rm -f $^
else
install.systemd:

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Wait for system level network-online.target as user.
Documentation=https://github.com/containers/podman/issues/22197
Documentation=man:podman-systemd.unit(5)
[Service]
Type=oneshot
# Set a timeout as by default oneshot does not have one and in case network-online.target
# never comes online we do not want to block forever, 90s is the default systemd unit timeout.
TimeoutStartSec=90s
ExecStart=sh -c 'until systemctl is-active network-online.target; do sleep 0.5; done'
RemainAfterExit=yes