From ac347dc3402a50fa0ba8c04cf2f93c36283eca87 Mon Sep 17 00:00:00 2001 From: Owen Synge Date: Tue, 26 May 2015 19:02:36 +0200 Subject: [PATCH] Template systemd/ceph-osd@.service with autotools, The libexec path is different for different distributions. systemd. This path is defined by a new variable on the configure path. This variable can be set with enviroment SYSTEMD_LIBEXEC_DIR. The parameter --with-systemd-libexec-dir overrides the enviroment variable. Appropriate conditionals are set for SUSE and RHEL derivatives. This is then used to template out systemd/ceph-osd@.service Signed-off-by: Owen Synge --- ceph.spec.in | 6 +++ configure.ac | 42 +++++++++++++++++++ ...ceph-osd@.service => ceph-osd@.service.in} | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) rename systemd/{ceph-osd@.service => ceph-osd@.service.in} (79%) diff --git a/ceph.spec.in b/ceph.spec.in index 378254e2510d..8ab9c6530aa2 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -472,6 +472,12 @@ export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed -e 's/i386/i486/'` --with-debug \ --enable-cephfs-java \ --with-librocksdb-static=check \ +%if 0%{?rhel} || 0%{?fedora} + --with-systemd-libexec-dir=/usr/libexec/ceph \ +%endif +%if 0%{?opensuse} || 0%{?suse_version} + --with-systemd-libexec-dir=/usr/lib/ceph/ \ +%endif $MY_CONF_OPT \ %{?_with_ocf} \ CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" diff --git a/configure.ac b/configure.ac index b29583edad77..f4ac2cd1c78c 100644 --- a/configure.ac +++ b/configure.ac @@ -1160,6 +1160,47 @@ AS_IF([test "x$HAVE_VALGRIND" = "x"], AM_CONDITIONAL([VALGRIND_ENABLED], [test "x$enable_valgrind" = "xyes"]) +dnl systemd-libexec-dir +AC_SUBST(systemd_libexec_dir) +AC_ARG_WITH( + systemd-libexec-dir, + AS_HELP_STRING( + [--with-systemd-libexec-dir=DIR], + [systemd libexec directory @<:@SYSTEMD_LIBEXEC_DIR@:>@ + defaults to --libexecdir=DIR] + ), + [ + systemd_libexec_dir="$withval" + ], + [ + if test "x$SYSTEMD_LIBEXEC_DIR" = "x"; then + dnl store old values + + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix="$ac_default_prefix" + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + dnl now get the expanded default + systemd_libexec_dir="`eval exec_prefix=$exec_prefix prefix=$prefix echo $libexecdir`" + + dnl now cleanup prefix and exec_prefix + + prefix=$prefix_save + exec_prefix=$exec_prefix_save + else + systemd_libexec_dir="$SYSTEMD_LIBEXEC_DIR" + fi + ] +) + # Checks for typedefs, structures, and compiler characteristics. #AC_HEADER_STDBOOL #AC_C_CONST @@ -1222,5 +1263,6 @@ AC_CONFIG_FILES([Makefile src/tracing/Makefile man/Makefile doc/Makefile + systemd/ceph-osd@.service ceph.spec]) AC_OUTPUT diff --git a/systemd/ceph-osd@.service b/systemd/ceph-osd@.service.in similarity index 79% rename from systemd/ceph-osd@.service rename to systemd/ceph-osd@.service.in index c12b56c9fb97..fd300871dd7a 100644 --- a/systemd/ceph-osd@.service +++ b/systemd/ceph-osd@.service.in @@ -8,7 +8,7 @@ PartOf=ceph.target EnvironmentFile=-/etc/sysconfig/ceph Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i -ExecStartPre=/usr/libexec/ceph/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i +ExecStartPre=@systemd_libexec_dir@/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i LimitNOFILE=131072 [Install] -- 2.47.3