From 9bcc97bc5e4e22d10c477bbeeb73f1b664d50998 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Tue, 31 Oct 2017 20:19:46 +0100 Subject: [PATCH] install cryptsetup_tmpfiles.conf add --with-tmpfilesdir configuration option. Use the option either to override default systemd tmpfiles.d directory location or to specify install location for systems without systemd. --- Makefile.am | 6 ++++++ configure.ac | 12 ++++++++++++ scripts/Makemodule.am | 11 ++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 9d2bb6eb..e6fca17c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,6 +3,7 @@ SUBDIRS = po tests TESTS = CLEANFILES = DISTCLEAN_TARGETS = +INSTALL_DATA_HOOKS = AM_CPPFLAGS = \ -include config.h \ @@ -16,9 +17,12 @@ AM_CPPFLAGS = \ AM_CFLAGS = -Wall AM_LDFLAGS = +tmpfilesddir = @DEFAULT_TMPFILESDIR@ + noinst_LTLIBRARIES = sbin_PROGRAMS = man8_MANS = +tmpfilesd_DATA = include man/Makemodule.am @@ -44,3 +48,5 @@ distclean-local: clean-local: -rm -rf docs/doxygen_api_docs + +install-data-hook: $(INSTALL_DATA_HOOKS) diff --git a/configure.ac b/configure.ac index bbfa716f..eadfc59e 100644 --- a/configure.ac +++ b/configure.ac @@ -425,6 +425,8 @@ if test x$enable_static_cryptsetup = xyes; then PKG_CONFIG=$saved_PKG_CONFIG fi +PKG_CHECK_VAR([systemd_tmpfilesdir], [systemd], [tmpfilesdir], [], [systemd_tmpfilesdir=no]) + AC_SUBST([DEVMAPPER_LIBS]) AC_SUBST([DEVMAPPER_STATIC_LIBS]) @@ -525,6 +527,16 @@ CS_NUM_WITH([verity-hash-block], [hash block size for verity mode], [4096]) CS_NUM_WITH([verity-salt-size], [salt size for verity mode], [32]) CS_NUM_WITH([verity-fec-roots], [parity bytes for verity FEC], [2]) +CS_STR_WITH([tmpfilesdir], [override default path to directory with systemd temporary files], [$systemd_tmpfilesdir]) +test -z "$with_tmpfilesdir" && with_tmpfilesdir=$systemd_tmpfilesdir +test "x$with_tmpfilesdir" == "xno" || { + test "${with_tmpfilesdir:0:1}" = "/" || AC_MSG_ERROR([--with-tmpfilesdir argument must be an absolute path.]) + DEFAULT_TMPFILESDIR=$with_tmpfilesdir + AC_SUBST(DEFAULT_TMPFILESDIR) +} +AM_CONDITIONAL(CRYPTSETUP_TMPFILE, test -n "$DEFAULT_TMPFILESDIR") + + CS_STR_WITH([luks2-lock-path], [path to directory for LUKSv2 locks], [/run/lock/cryptsetup]) test -z "$with_luks2_lock_path" && with_luks2_lock_path=/run/lock/cryptsetup test "${with_luks2_lock_path:0:1}" = "/" || AC_MSG_ERROR([--with-luks2-lock-path argument must be an absolute path.]) diff --git a/scripts/Makemodule.am b/scripts/Makemodule.am index 16d0d3bd..382e6232 100644 --- a/scripts/Makemodule.am +++ b/scripts/Makemodule.am @@ -1 +1,10 @@ -DISTCLEAN_TARGETS += cryptsetup_tmpfiles.conf +DISTCLEAN_TARGETS += scripts/cryptsetup_tmpfiles.conf + +if CRYPTSETUP_TMPFILE +tmpfilesd_DATA += scripts/cryptsetup_tmpfiles.conf + +install-data-hooks-tmpfiles: + mv $(DESTDIR)$(tmpfilesddir)/cryptsetup_tmpfiles.conf $(DESTDIR)$(tmpfilesddir)/cryptsetup.conf + +INSTALL_DATA_HOOKS += install-data-hooks-tmpfiles +endif