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 <mbasti@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Petr Spacek
2016-11-03 11:03:03 +01:00
committed by Martin Babinsky
parent a027bf7398
commit 288d624336
17 changed files with 100 additions and 44 deletions

7
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

20
init/Makefile.am Normal file
View File

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

View File

@@ -1,5 +0,0 @@
SOCKET_PATH=/var/run/ipa_memcached/ipa_memcached
USER=apache
MAXCONN=1024
CACHESIZE=64
OPTIONS=

5
init/ipa_memcached.in Normal file
View File

@@ -0,0 +1,5 @@
SOCKET_PATH=@localstatedir@/run/ipa_memcached/ipa_memcached
USER=apache
MAXCONN=1024
CACHESIZE=64
OPTIONS=

24
init/systemd/Makefile.am Normal file
View File

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

View File

@@ -4,7 +4,7 @@ Description=IPA Custodia Service
[Service]
Type=simple
ExecStart=/usr/sbin/custodia /etc/ipa/custodia/custodia.conf
ExecStart=@sbindir@/custodia @IPA_SYSCONF_DIR@/custodia/custodia.conf
PrivateTmp=yes
Restart=on-failure
RestartSec=60s

View File

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

View File

@@ -5,8 +5,8 @@ After=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/ipactl start
ExecStop=/usr/sbin/ipactl stop
ExecStart=@sbindir@/ipactl start
ExecStop=@sbindir@/ipactl stop
RemainAfterExit=yes
TimeoutSec=0

View File

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

View File

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

View File

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

View File

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