sideload-repos-systemd: Use systemd-tmpfiles

Instead of using a systemd service to create the directory we need for
sideloading (/run/flatpak/sideload-repos), use a systemd-tmpfiles conf
file. This is more elegant, and the service also had a bug which meant
it would create a "/run/flatpak;" directory instead of the one intended.

Since systemd-tmpfiles-setup.service runs before sysinit.target and path
units are run after sysinit.target, the tmp directory should be in place
when flatpak-sideload-usb-repo.path runs in the systemd user instance.

Endless OS already has a file at /lib/tmpfiles.d/flatpak.conf, so we
can't use that filename.
This commit is contained in:
Phaedrus Leeds 2020-09-11 11:48:21 -07:00 committed by Alexander Larsson
parent 238317d99b
commit d73d6c16f3
3 changed files with 6 additions and 18 deletions

View File

@ -8,11 +8,13 @@ systemduserunit_DATA += sideload-repos-systemd/flatpak-sideload-usb-repo.service
path_in_files = sideload-repos-systemd/flatpak-sideload-usb-repo.path.in
systemduserunit_DATA += sideload-repos-systemd/flatpak-sideload-usb-repo.path
systemdsystemunit_DATA += sideload-repos-systemd/flatpak-sideload-repos-dir.service
%.path: %.path.in config.log
$(AM_V_GEN) $(SED) -e "s|\@media_dir\@|$(RUN_MEDIA_DIR)|" $< > $@
tmpfilesdir = $(prefix)/lib/tmpfiles.d
dist_tmpfiles_DATA = sideload-repos-systemd/tmpfiles.d/flatpak-sideload-repos.conf
endif
EXTRA_DIST += sideload-repos-systemd/flatpak-sideload-usb-repo.path.in sideload-repos-systemd/flatpak-sideload-usb-repo.service.in sideload-repos-systemd/flatpak-sideload-repos-dir.service
EXTRA_DIST += sideload-repos-systemd/flatpak-sideload-usb-repo.path.in sideload-repos-systemd/flatpak-sideload-usb-repo.service.in

View File

@ -1,15 +0,0 @@
# This unit is intended to be installed in the systemd system instance, so that
# flatpak-sideload-usb-repo.{path,service} can work in the user instance
[Service]
Type=oneshot
ExecStart=/bin/mkdir -p /run/flatpak; /bin/mkdir -p -m 777 /run/flatpak/sideload-repos
[Unit]
# Use basic.target to guarantee we run before flatpak-sideload-usb-repos.path
# in the user systemd instance
Before=basic.target
After=sysinit.target
DefaultDependencies=no
[Install]
WantedBy=basic.target

View File

@ -0,0 +1 @@
D /run/flatpak/sideload-repos 0777 - - -