From a18d406b5631f80134e202ae3310580683937f92 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 11 Jun 2020 11:17:25 +0200 Subject: [PATCH] Move ipa-epn systemd files and run RPM hooks The init/systemd directory is for server only and not part of CLIENT_ONLY builds. It's necesary to run pre/post installation hooks to make systemd aware of new files. Fixes: https://pagure.io/freeipa/issue/8367 Signed-off-by: Christian Heimes Reviewed-By: Rob Crittenden Reviewed-By: Francois Cami --- .gitignore | 4 +-- client/Makefile.am | 1 + client/share/Makefile.am | 5 ++++ {install => client}/share/expire_msg.template | 0 client/systemd/Makefile.am | 27 +++++++++++++++++++ {init => client}/systemd/ipa-epn.service.in | 0 {init => client}/systemd/ipa-epn.timer.in | 0 configure.ac | 24 +++++++++++++++-- freeipa.spec.in | 15 +++++++++++ init/systemd/Makefile.am | 8 +++--- install/share/Makefile.am | 5 ---- server.m4 | 19 ------------- 12 files changed, 76 insertions(+), 32 deletions(-) rename {install => client}/share/expire_msg.template (100%) create mode 100644 client/systemd/Makefile.am rename {init => client}/systemd/ipa-epn.service.in (100%) rename {init => client}/systemd/ipa-epn.timer.in (100%) diff --git a/.gitignore b/.gitignore index acd273617..3d2118112 100644 --- a/.gitignore +++ b/.gitignore @@ -98,8 +98,6 @@ freeipa2-dev-doc /init/ipa_memcached /init/systemd/ipa-custodia.service /init/systemd/ipa.service -/init/systemd/ipa-epn.service -/init/systemd/ipa-epn.timer /init/tmpfilesd/ipa.conf !/install/ui/doc/Makefile.in @@ -120,6 +118,8 @@ freeipa2-dev-doc /client/ipa-getkeytab /client/ipa-join /client/ipa-rmkeytab +/client/systemd/ipa-epn.service +/client/systemd/ipa-epn.timer /ipaplatform/override.py /ipapython/version.py diff --git a/client/Makefile.am b/client/Makefile.am index 858a9369e..87da87fcd 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -95,6 +95,7 @@ SUBDIRS = \ share \ man \ sysconfig \ + systemd \ $(NULL) # init diff --git a/client/share/Makefile.am b/client/share/Makefile.am index 6d4a62d5e..1402a3a9d 100644 --- a/client/share/Makefile.am +++ b/client/share/Makefile.am @@ -4,3 +4,8 @@ appdir = $(IPA_DATA_DIR)/client dist_app_DATA = \ freeipa.template \ $(NULL) + +epnconfdir = $(IPA_SYSCONF_DIR)/epn +dist_epnconf_DATA = \ + expire_msg.template \ + $(NULL) diff --git a/install/share/expire_msg.template b/client/share/expire_msg.template similarity index 100% rename from install/share/expire_msg.template rename to client/share/expire_msg.template diff --git a/client/systemd/Makefile.am b/client/systemd/Makefile.am new file mode 100644 index 000000000..1f591be83 --- /dev/null +++ b/client/systemd/Makefile.am @@ -0,0 +1,27 @@ +# This file will be processed with automake-1.7 to create Makefile.in +# +AUTOMAKE_OPTIONS = 1.7 + +NULL = + +dist_noinst_DATA = \ + ipa-epn.service.in \ + ipa-epn.timer.in \ + $(NULL) + +systemdsystemunit_DATA = \ + ipa-epn.service \ + ipa-epn.timer \ + $(NULL) + +CLEANFILES = $(systemdsystemunit_DATA) + +%: %.in Makefile + sed \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@IPA_SYSCONF_DIR[@]|$(IPA_SYSCONF_DIR)|g' \ + -e 's|@localstatedir[@]|$(localstatedir)|g' \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@libexecdir[@]|$(libexecdir)|g' \ + -e 's|@sysconfenvdir[@]|$(sysconfenvdir)|g' \ + '$(srcdir)/$@.in' >$@ diff --git a/init/systemd/ipa-epn.service.in b/client/systemd/ipa-epn.service.in similarity index 100% rename from init/systemd/ipa-epn.service.in rename to client/systemd/ipa-epn.service.in diff --git a/init/systemd/ipa-epn.timer.in b/client/systemd/ipa-epn.timer.in similarity index 100% rename from init/systemd/ipa-epn.timer.in rename to client/systemd/ipa-epn.timer.in diff --git a/configure.ac b/configure.ac index 36f9a1ebf..2c9bef02c 100644 --- a/configure.ac +++ b/configure.ac @@ -220,6 +220,25 @@ AC_ARG_WITH([runstatedir], [runstatedir="/run"]) AC_SUBST([runstatedir]) +dnl --------------------------------------------------------------------------- +dnl - Check for systemd directories +dnl --------------------------------------------------------------------------- + +PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], + [Directory for systemd service files]), + [systemdsystemunitdir=$with_systemdsystemunitdir], + [systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=systemdsystemunitdir systemd)]) +AC_SUBST([systemdsystemunitdir]) + +AC_ARG_WITH([systemdtmpfilesdir], + AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], + [Directory for systemd-tmpfiles configuration files]), + [systemdtmpfilesdir=$with_systemdtmpfilesdir], + [systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=tmpfilesdir systemd)]) +AC_SUBST([systemdtmpfilesdir]) + dnl --------------------------------------------------------------------------- dnl - Server-only configuration dnl --------------------------------------------------------------------------- @@ -544,6 +563,7 @@ AC_CONFIG_FILES([ client/share/Makefile client/man/Makefile client/sysconfig/Makefile + client/systemd/Makefile contrib/completion/Makefile contrib/Makefile daemons/dnssec/Makefile @@ -638,13 +658,13 @@ echo " jslint: ${JSLINT} LDAP libs: ${LDAP_LIBS} OpenSSL crypto libs: ${CRYPTO_LIBS} - KRB5 libs: ${KRB5_LIBS}" + KRB5 libs: ${KRB5_LIBS} + systemdsystemunitdir: ${systemdsystemunitdir}" AM_COND_IF([ENABLE_SERVER], [ echo "\ KRAD libs: ${KRAD_LIBS} krb5rundir: ${krb5rundir} - systemdsystemunitdir: ${systemdsystemunitdir} systemdtmpfilesdir: ${systemdtmpfilesdir} build mode: server & client" ], [ diff --git a/freeipa.spec.in b/freeipa.spec.in index b6eb79593..bf0bee128 100755 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -591,6 +591,10 @@ on the machine enrolled into a FreeIPA environment %package client-epn Summary: Tools to configure Expiring Password Notification in IPA Group: System Environment/Base +Requires: systemd-units +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units Requires: %{name}-client = %{version}-%{release} %description client-epn @@ -1011,6 +1015,17 @@ fi # ONLY_CLIENT %endif +%preun client-epn +%systemd_preun ipa-epn.service +%systemd_preun ipa-epn.timer + +%postun client-epn +%systemd_postun ipa-epn.service +%systemd_postun ipa-epn.timer + +%post client-epn +%systemd_post ipa-epn.service +%systemd_post ipa-epn.timer %post client if [ $1 -gt 1 ] ; then diff --git a/init/systemd/Makefile.am b/init/systemd/Makefile.am index 5053dbff6..175178787 100644 --- a/init/systemd/Makefile.am +++ b/init/systemd/Makefile.am @@ -2,17 +2,17 @@ # AUTOMAKE_OPTIONS = 1.7 +NULL = + dist_noinst_DATA = \ ipa-custodia.service.in \ ipa.service.in \ - ipa-epn.service.in \ - ipa-epn.timer.in + $(NULL) systemdsystemunit_DATA = \ ipa-custodia.service \ ipa.service \ - ipa-epn.service \ - ipa-epn.timer + $(NULL) CLEANFILES = $(systemdsystemunit_DATA) diff --git a/install/share/Makefile.am b/install/share/Makefile.am index 496e81288..e95796dfb 100644 --- a/install/share/Makefile.am +++ b/install/share/Makefile.am @@ -106,8 +106,3 @@ dist_app_DATA = \ kdcproxyconfdir = $(IPA_SYSCONF_DIR)/kdcproxy dist_kdcproxyconf_DATA = \ kdcproxy.conf - -epnconfdir = $(IPA_SYSCONF_DIR)/epn -dist_epnconf_DATA = \ - expire_msg.template \ - $(NULL) diff --git a/server.m4 b/server.m4 index d35823e80..842d599d2 100644 --- a/server.m4 +++ b/server.m4 @@ -153,22 +153,3 @@ dnl Check for libverto dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([LIBVERTO], [libverto]) - -dnl --------------------------------------------------------------------------- -dnl - Check for systemd directories -dnl --------------------------------------------------------------------------- - -PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) -AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], - [Directory for systemd service files]), - [systemdsystemunitdir=$with_systemdsystemunitdir], - [systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=systemdsystemunitdir systemd)]) -AC_SUBST([systemdsystemunitdir]) - -AC_ARG_WITH([systemdtmpfilesdir], - AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], - [Directory for systemd-tmpfiles configuration files]), - [systemdtmpfilesdir=$with_systemdtmpfilesdir], - [systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=tmpfilesdir systemd)]) -AC_SUBST([systemdtmpfilesdir])