From 288d624336d502a7df9856cdc2f6543b6e7c0b79 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Thu, 3 Nov 2016 11:03:03 +0100 Subject: Build: integrate init and init/systemd into build system At the same time, I've renamed tmpfilesd config file to static name "ipa.conf" instead of using package-specific name. It had no purpose and just complicated build and packaging. Variable substitution into configuration has to be done in Makefile and not in Autoconf as documented in: Autoconf v2.69 manual chapter 4.8.2 Installation Directory Variables: ... Most of these variables have values that rely on prefix or exec_prefix. ... Similarly, you should not rely on AC_CONFIG_FILES to replace bindir and friends in your shell scripts and other files; instead, let make manage their replacement. https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti Reviewed-By: Christian Heimes --- .gitignore | 7 +++++++ Makefile.am | 3 +-- configure.ac | 13 ++++++++++++- freeipa.spec.in | 17 +---------------- init/Makefile.am | 20 ++++++++++++++++++++ init/ipa-dnskeysyncd | 0 init/ipa-dnskeysyncd.conf | 0 init/ipa-ods-exporter | 0 init/ipa-ods-exporter.conf | 0 init/ipa_memcached.conf | 5 ----- init/ipa_memcached.in | 5 +++++ init/systemd/Makefile.am | 24 ++++++++++++++++++++++++ init/systemd/ipa-custodia.service | 13 ------------- init/systemd/ipa-custodia.service.in | 13 +++++++++++++ init/systemd/ipa.conf.tmpfiles | 5 ----- init/systemd/ipa.service | 14 -------------- init/systemd/ipa.service.in | 14 ++++++++++++++ init/systemd/ipa_memcached.service | 12 ------------ init/systemd/ipa_memcached.service.in | 12 ++++++++++++ init/tmpfilesd/Makefile.am | 10 ++++++++++ init/tmpfilesd/ipa.conf.in | 5 +++++ 21 files changed, 124 insertions(+), 68 deletions(-) create mode 100644 init/Makefile.am create mode 100644 init/ipa-dnskeysyncd delete mode 100644 init/ipa-dnskeysyncd.conf create mode 100644 init/ipa-ods-exporter delete mode 100644 init/ipa-ods-exporter.conf delete mode 100644 init/ipa_memcached.conf create mode 100644 init/ipa_memcached.in create mode 100644 init/systemd/Makefile.am delete mode 100644 init/systemd/ipa-custodia.service create mode 100644 init/systemd/ipa-custodia.service.in delete mode 100644 init/systemd/ipa.conf.tmpfiles delete mode 100644 init/systemd/ipa.service create mode 100644 init/systemd/ipa.service.in delete mode 100644 init/systemd/ipa_memcached.service create mode 100644 init/systemd/ipa_memcached.service.in create mode 100644 init/tmpfilesd/Makefile.am create mode 100644 init/tmpfilesd/ipa.conf.in diff --git a/.gitignore b/.gitignore index 38c21d6c4..397ae92a2 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,13 @@ freeipa2-dev-doc /po/test.po /po/test_locale/xh_ZA/LC_MESSAGES/ipa.mo + +/init/ipa_memcached +/init/systemd/ipa-custodia.service +/init/systemd/ipa.service +/init/systemd/ipa_memcached.service +/init/tmpfilesd/ipa.conf + !/install/ui/doc/Makefile.in /install/ui/release /install/ui/css/ipa.css diff --git a/Makefile.am b/Makefile.am index e752585d8..6f9015540 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,5 @@ -SUBDIRS = asn1 util client contrib daemons install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po +SUBDIRS = asn1 util client contrib daemons init install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po # doc -# init MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo diff --git a/configure.ac b/configure.ac index 1a6e489a0..0fafe0d38 100644 --- a/configure.ac +++ b/configure.ac @@ -241,7 +241,7 @@ dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([INI], [ini_config >= 1.2.0]) dnl --------------------------------------------------------------------------- -dnl - Check for systemd unit directory +dnl - Check for systemd directories dnl --------------------------------------------------------------------------- PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) AC_ARG_WITH([systemdsystemunitdir], @@ -251,6 +251,13 @@ AC_ARG_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 - Get /etc/sysconfig directory path dnl --------------------------------------------------------------------------- @@ -451,6 +458,9 @@ AC_CONFIG_FILES([ daemons/ipa-slapi-plugins/topology/Makefile daemons/ipa-version.h freeipa.spec + init/systemd/Makefile + init/tmpfilesd/Makefile + init/Makefile install/Makefile install/certmonger/Makefile install/conf/Makefile @@ -510,6 +520,7 @@ echo " datadir: ${datadir} krb5rundir: ${krb5rundir} systemdsystemunitdir: ${systemdsystemunitdir} + systemdtmpfilesdir: ${systemdtmpfilesdir} source code location: ${srcdir} compiler: ${CC} cflags: ${CFLAGS} diff --git a/freeipa.spec.in b/freeipa.spec.in index 6a8d31386..41c56ca2b 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -792,9 +792,6 @@ mkdir -p %{buildroot}%{_usr}/share/ipa/html/ /bin/touch %{buildroot}%{_usr}/share/ipa/html/krb5.ini /bin/touch %{buildroot}%{_usr}/share/ipa/html/krbrealm.con mkdir -p %{buildroot}%{_initrddir} -install -m 644 init/ipa_memcached.conf %{buildroot}%{_sysconfdir}/sysconfig/ipa_memcached -install -m 644 init/ipa-dnskeysyncd.conf %{buildroot}%{_sysconfdir}/sysconfig/ipa-dnskeysyncd -install -m 644 init/ipa-ods-exporter.conf %{buildroot}%{_sysconfdir}/sysconfig/ipa-ods-exporter # Web UI plugin dir mkdir -p %{buildroot}%{_usr}/share/ipa/ui/js/plugins @@ -803,11 +800,6 @@ mkdir -p %{buildroot}%{_usr}/share/ipa/ui/js/plugins mkdir -p %{buildroot}%{_sysconfdir}/ipa/kdcproxy/ install -m 644 install/share/kdcproxy.conf %{buildroot}%{_sysconfdir}/ipa/kdcproxy/kdcproxy.conf -# NOTE: systemd specific section -mkdir -p %{buildroot}%{_tmpfilesdir} -install -m 0644 init/systemd/ipa.conf.tmpfiles %{buildroot}%{_tmpfilesdir}/%{name}.conf -# END - mkdir -p %{buildroot}%{_localstatedir}/run/ install -d -m 0700 %{buildroot}%{_localstatedir}/run/ipa_memcached/ install -d -m 0700 %{buildroot}%{_localstatedir}/run/ipa/ @@ -818,13 +810,6 @@ install -d -m 0700 %{buildroot}%{_localstatedir}/run/httpd/ipa/krbcache mkdir -p %{buildroot}%{_libdir}/krb5/plugins/libkrb5 touch %{buildroot}%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so -# NOTE: systemd specific section -mkdir -p %{buildroot}%{_unitdir} -mkdir -p %{buildroot}%{etc_systemd_dir} -install -m 644 init/systemd/ipa.service %{buildroot}%{_unitdir}/ipa.service -install -m 644 init/systemd/ipa_memcached.service %{buildroot}%{_unitdir}/ipa_memcached.service -install -m 644 init/systemd/ipa-custodia.service %{buildroot}%{_unitdir}/ipa-custodia.service -# END mkdir -p %{buildroot}/%{_localstatedir}/lib/ipa/backup %endif # ONLY_CLIENT @@ -1132,7 +1117,7 @@ fi %dir %attr(0700,apache,apache) %{_localstatedir}/run/httpd/ipa/clientcaches/ %dir %attr(0700,apache,apache) %{_localstatedir}/run/httpd/ipa/krbcache/ # NOTE: systemd specific section -%{_tmpfilesdir}/%{name}.conf +%{_tmpfilesdir}/ipa.conf %attr(644,root,root) %{_unitdir}/ipa_memcached.service %attr(644,root,root) %{_unitdir}/ipa-custodia.service %ghost %attr(644,root,root) %{etc_systemd_dir}/httpd.d/ipa.conf diff --git a/init/Makefile.am b/init/Makefile.am new file mode 100644 index 000000000..47f844ac1 --- /dev/null +++ b/init/Makefile.am @@ -0,0 +1,20 @@ +# This file will be processed with automake-1.7 to create Makefile.in +# +AUTOMAKE_OPTIONS = 1.7 + +SUBDIRS = systemd tmpfilesd + +dist_sysconfenv_DATA = \ + ipa-dnskeysyncd \ + ipa-ods-exporter + +nodist_sysconfenv_DATA = \ + ipa_memcached + +CLEANFILES = $(nodist_sysconfenv_DATA) + +dist_noinst_DATA = \ + ipa_memcached.in + +%: %.in Makefile + sed -e 's|@localstatedir[@]|$(localstatedir)|g' '$(srcdir)/$@.in' >$@ diff --git a/init/ipa-dnskeysyncd b/init/ipa-dnskeysyncd new file mode 100644 index 000000000..e69de29bb diff --git a/init/ipa-dnskeysyncd.conf b/init/ipa-dnskeysyncd.conf deleted file mode 100644 index e69de29bb..000000000 diff --git a/init/ipa-ods-exporter b/init/ipa-ods-exporter new file mode 100644 index 000000000..e69de29bb diff --git a/init/ipa-ods-exporter.conf b/init/ipa-ods-exporter.conf deleted file mode 100644 index e69de29bb..000000000 diff --git a/init/ipa_memcached.conf b/init/ipa_memcached.conf deleted file mode 100644 index 19d912742..000000000 --- a/init/ipa_memcached.conf +++ /dev/null @@ -1,5 +0,0 @@ -SOCKET_PATH=/var/run/ipa_memcached/ipa_memcached -USER=apache -MAXCONN=1024 -CACHESIZE=64 -OPTIONS= diff --git a/init/ipa_memcached.in b/init/ipa_memcached.in new file mode 100644 index 000000000..56701383d --- /dev/null +++ b/init/ipa_memcached.in @@ -0,0 +1,5 @@ +SOCKET_PATH=@localstatedir@/run/ipa_memcached/ipa_memcached +USER=apache +MAXCONN=1024 +CACHESIZE=64 +OPTIONS= diff --git a/init/systemd/Makefile.am b/init/systemd/Makefile.am new file mode 100644 index 000000000..e978fe974 --- /dev/null +++ b/init/systemd/Makefile.am @@ -0,0 +1,24 @@ +# This file will be processed with automake-1.7 to create Makefile.in +# +AUTOMAKE_OPTIONS = 1.7 + +dist_noinst_DATA = \ + ipa-custodia.service.in \ + ipa_memcached.service.in \ + ipa.service.in + +systemdsystemunit_DATA = \ + ipa-custodia.service \ + ipa_memcached.service \ + ipa.service + +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|@sysconfenvdir[@]|$(sysconfenvdir)|g' \ + '$(srcdir)/$@.in' >$@ diff --git a/init/systemd/ipa-custodia.service b/init/systemd/ipa-custodia.service deleted file mode 100644 index ff930fbbb..000000000 --- a/init/systemd/ipa-custodia.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=IPA Custodia Service - -[Service] -Type=simple - -ExecStart=/usr/sbin/custodia /etc/ipa/custodia/custodia.conf -PrivateTmp=yes -Restart=on-failure -RestartSec=60s - -[Install] -WantedBy=multi-user.target diff --git a/init/systemd/ipa-custodia.service.in b/init/systemd/ipa-custodia.service.in new file mode 100644 index 000000000..3f9b128aa --- /dev/null +++ b/init/systemd/ipa-custodia.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=IPA Custodia Service + +[Service] +Type=simple + +ExecStart=@sbindir@/custodia @IPA_SYSCONF_DIR@/custodia/custodia.conf +PrivateTmp=yes +Restart=on-failure +RestartSec=60s + +[Install] +WantedBy=multi-user.target diff --git a/init/systemd/ipa.conf.tmpfiles b/init/systemd/ipa.conf.tmpfiles deleted file mode 100644 index 6eab2621c..000000000 --- a/init/systemd/ipa.conf.tmpfiles +++ /dev/null @@ -1,5 +0,0 @@ -d /var/run/ipa_memcached 0700 apache apache -d /var/run/ipa 0700 root root -d /var/run/httpd/ipa 0700 apache apache -d /var/run/httpd/ipa/clientcaches 0700 apache apache -d /var/run/httpd/ipa/krbcache 0700 apache apache diff --git a/init/systemd/ipa.service b/init/systemd/ipa.service deleted file mode 100644 index 8cfcf7c54..000000000 --- a/init/systemd/ipa.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Identity, Policy, Audit -Requires=network.target -After=network.target - -[Service] -Type=oneshot -ExecStart=/usr/sbin/ipactl start -ExecStop=/usr/sbin/ipactl stop -RemainAfterExit=yes -TimeoutSec=0 - -[Install] -WantedBy=multi-user.target diff --git a/init/systemd/ipa.service.in b/init/systemd/ipa.service.in new file mode 100644 index 000000000..9acd587e5 --- /dev/null +++ b/init/systemd/ipa.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=Identity, Policy, Audit +Requires=network.target +After=network.target + +[Service] +Type=oneshot +ExecStart=@sbindir@/ipactl start +ExecStop=@sbindir@/ipactl stop +RemainAfterExit=yes +TimeoutSec=0 + +[Install] +WantedBy=multi-user.target diff --git a/init/systemd/ipa_memcached.service b/init/systemd/ipa_memcached.service deleted file mode 100644 index a4857cd4a..000000000 --- a/init/systemd/ipa_memcached.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=IPA memcached daemon, increases IPA server performance -After=network.target - -[Service] -Type=forking -EnvironmentFile=/etc/sysconfig/ipa_memcached -PIDFile=/var/run/ipa_memcached/ipa_memcached.pid -ExecStart=/usr/bin/memcached -d -s $SOCKET_PATH -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/ipa_memcached/ipa_memcached.pid $OPTIONS - -[Install] -WantedBy=multi-user.target diff --git a/init/systemd/ipa_memcached.service.in b/init/systemd/ipa_memcached.service.in new file mode 100644 index 000000000..0e163203a --- /dev/null +++ b/init/systemd/ipa_memcached.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=IPA memcached daemon, increases IPA server performance +After=network.target + +[Service] +Type=forking +EnvironmentFile=@sysconfenvdir@/ipa_memcached +PIDFile=@localstatedir@/run/ipa_memcached/ipa_memcached.pid +ExecStart=@bindir@/memcached -d -s $SOCKET_PATH -u $USER -m $CACHESIZE -c $MAXCONN -P @localstatedir@/run/ipa_memcached/ipa_memcached.pid $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/init/tmpfilesd/Makefile.am b/init/tmpfilesd/Makefile.am new file mode 100644 index 000000000..40b9cd5a5 --- /dev/null +++ b/init/tmpfilesd/Makefile.am @@ -0,0 +1,10 @@ +dist_noinst_DATA = \ + ipa.conf.in + +systemdtmpfiles_DATA = \ + ipa.conf + +CLEANFILES = $(systemdtmpfiles_DATA) + +%: %.in Makefile + sed -e 's|@localstatedir[@]|$(localstatedir)|g' '$(srcdir)/$@.in' >$@ diff --git a/init/tmpfilesd/ipa.conf.in b/init/tmpfilesd/ipa.conf.in new file mode 100644 index 000000000..4954000a3 --- /dev/null +++ b/init/tmpfilesd/ipa.conf.in @@ -0,0 +1,5 @@ +d @localstatedir@/run/ipa_memcached 0700 apache apache +d @localstatedir@/run/ipa 0700 root root +d @localstatedir@/run/httpd/ipa 0700 apache apache +d @localstatedir@/run/httpd/ipa/clientcaches 0700 apache apache +d @localstatedir@/run/httpd/ipa/krbcache 0700 apache apache -- cgit