Skip to content

Commit

Permalink
build: fix systemd-sysusers/-tmpfiles invocation
Browse files Browse the repository at this point in the history
systemd-sysusers/-tmpfiles needs to be executed in install-data-hook
instead of install-exec-hook, otherwise the configuration files
sysusers/tmpfiles_DATA are not installed yet.

Automake only allows a single hook of each type, and there is already
one for prepending the udev rules file with a prefix, so these hooks
need to be consolidated: if WITH_UDEVRULESPREFIX is false,
udevrulesprefix is empty, so the mv operation fails since source and
target are the same file. Ignore this error since it is harmless.

Also consolidate uninstall-hook into uninstall-local for simplicity.

Fixes: 7502887
Signed-off-by: Jonas Witschel <diabonas@gmx.de>
  • Loading branch information
diabonas authored and tstruk committed May 12, 2020
1 parent 9965232 commit e195321
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -580,20 +580,13 @@ install-man: install-man3 install-man7

EXTRA_DIST += dist/tpm-udev.rules

if WITH_UDEVRULESPREFIX
install-data-hook:
mv $(DESTDIR)$(udevrulesdir)/tpm-udev.rules $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules

uninstall-local:
-rm $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
endif

# Create tss user and FAPI directories directly after installation (vs. after a reboot)
install-exec-hook:
-mv $(DESTDIR)$(udevrulesdir)/tpm-udev.rules $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
(systemd-sysusers && systemd-tmpfiles --create) || \
($(call make_tss_user_and_group) && $(call make_fapi_dirs) && ($call set_fapi_permissions)) || true

uninstall-hook:
uninstall-local:
-rm $(DESTDIR)$(udevrulesdir)/$(udevrulesprefix)tpm-udev.rules
cd $(DESTDIR)$(man3dir) && \
[ -L Tss2_TctiLdr_Initialize_Ex.3 ] && \
rm -f Tss2_TctiLdr_Initialize_Ex.3 || true
Expand Down

0 comments on commit e195321

Please sign in to comment.