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 <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
This commit is contained in:
Christian Heimes 2020-06-11 11:17:25 +02:00 committed by François Cami
parent 1487665779
commit a18d406b56
12 changed files with 76 additions and 32 deletions

4
.gitignore vendored
View File

@ -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

View File

@ -95,6 +95,7 @@ SUBDIRS = \
share \
man \
sysconfig \
systemd \
$(NULL)
# init

View File

@ -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)

View File

@ -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' >$@

View File

@ -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"
], [

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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])