Add user systemd service and socket

This enables user to interact with varlink and create/manage rootless
containers through it.

Using as:
`varlink call unix:/run/user/1000/podman/io.podman/io.podman.ListContainers`

Signed-off-by: Matej Marusak <mmarusak@redhat.com>
This commit is contained in:
Matej Marusak
2019-07-25 12:39:26 +02:00
parent 9bee6907a5
commit daf7044aa9
4 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,7 @@ SHAREDIR_CONTAINERS ?= ${PREFIX}/share/containers
ETCDIR ?= /etc
TMPFILESDIR ?= ${PREFIX}/lib/tmpfiles.d
SYSTEMDDIR ?= ${PREFIX}/lib/systemd/system
USERSYSTEMDDIR ?= ${PREFIX}/lib/systemd/user
BUILDFLAGS ?=
BUILDTAGS ?= \
$(shell hack/apparmor_tag.sh) \
@ -395,9 +396,11 @@ install.docker: docker-docs
install ${SELINUXOPT} -m 644 docs/docker*.1 -t $(DESTDIR)$(MANDIR)/man1
install.systemd:
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${TMPFILESDIR}
install ${SELINUXOPT} -m 755 -d ${DESTDIR}${SYSTEMDDIR} ${DESTDIR}${USERSYSTEMDDIR} ${DESTDIR}${TMPFILESDIR}
install ${SELINUXOPT} -m 644 contrib/varlink/io.podman.socket ${DESTDIR}${SYSTEMDDIR}/io.podman.socket
install ${SELINUXOPT} -m 644 contrib/varlink/io.podman.socket ${DESTDIR}${USERSYSTEMDDIR}/io.podman.socket
install ${SELINUXOPT} -m 644 contrib/varlink/io.podman.service ${DESTDIR}${SYSTEMDDIR}/io.podman.service
install ${SELINUXOPT} -m 644 contrib/varlink/io.podman.service ${DESTDIR}${USERSYSTEMDDIR}/io.podman.service
install ${SELINUXOPT} -m 644 contrib/varlink/podman.conf ${DESTDIR}${TMPFILESDIR}/podman.conf
uninstall:

View File

@ -389,6 +389,7 @@ popd
%install
install -dp %{buildroot}%{_unitdir}
install -dp %{buildroot}%{_usr}/lib/systemd/user
PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \
install.bin \
install.remote \
@ -487,6 +488,8 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
%{_datadir}/containers/%{repo}.conf
%{_unitdir}/io.podman.service
%{_unitdir}/io.podman.socket
%{_usr}/lib/systemd/user/io.podman.service
%{_usr}/lib/systemd/user/io.podman.socket
%{_usr}/lib/tmpfiles.d/%{name}.conf
%if 0%{?with_devel}

View File

@ -6,7 +6,8 @@ Documentation=man:podman-varlink(1)
[Service]
Type=simple
ExecStart=/usr/bin/podman varlink unix:/run/podman/io.podman
ExecStart=/usr/bin/podman varlink unix:%t/podman/io.podman
KillMode=none
[Install]
WantedBy=multi-user.target

View File

@ -3,7 +3,7 @@ Description=Podman Remote API Socket
Documentation=man:podman-varlink(1)
[Socket]
ListenStream=/run/podman/io.podman
ListenStream=%t/podman/io.podman
SocketMode=0600
[Install]