From eb9e0920b01f4bbcfc8bf6eb43b4a6c1dc7da796 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 10 Apr 2013 19:37:32 +0000 Subject: QPID-4733: Fix cmake installation of init scripts - Install both qpidd and qpidd-primary init scripts. - Fix path substitution to use absolute paths. - Fix substitution to work on cmake and automake. - Set executable permissions for init scripts. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1466645 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/etc/CMakeLists.txt | 15 ++++++++++++--- cpp/etc/Makefile.am | 2 +- cpp/etc/qpidd-primary.in | 6 +++--- cpp/etc/qpidd.in | 12 ++++++------ 4 files changed, 22 insertions(+), 13 deletions(-) (limited to 'cpp/etc') diff --git a/cpp/etc/CMakeLists.txt b/cpp/etc/CMakeLists.txt index 5bea1351e2..f2dbc85386 100644 --- a/cpp/etc/CMakeLists.txt +++ b/cpp/etc/CMakeLists.txt @@ -17,23 +17,32 @@ # under the License. # -set (bindir ${QPID_INSTALL_BINDIR}) -set (sysconfdir ${SYSCONF_INSTALL_DIR}) +# Use automake variable names as these files are also configured by automake. +set_absolute_install_path (bindir ${QPID_INSTALL_BINDIR}) +set_absolute_install_path (sysconfdir ${SYSCONF_INSTALL_DIR}) +set_absolute_install_path (sbindir ${QPID_INSTALL_SBINDIR}) + +configure_file(qpidd.in + ${CMAKE_CURRENT_BINARY_DIR}/qpidd + @ONLY) configure_file(qpidd-primary.in ${CMAKE_CURRENT_BINARY_DIR}/qpidd-primary @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qpidd-primary +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qpidd ${CMAKE_CURRENT_BINARY_DIR}/qpidd-primary + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION ${QPID_INSTALL_CONFDIR}/rc.d/init.d COMPONENT ${QPID_COMPONENT_BROKER}) install(FILES qpidc.conf DESTINATION ${QPID_INSTALL_CONFDIR}/qpid COMPONENT ${QPID_COMPONENT_CLIENT}) + install(FILES qpidd.conf DESTINATION ${QPID_INSTALL_CONFDIR} COMPONENT ${QPID_COMPONENT_BROKER}) + if (BUILD_SASL) install(FILES sasl2/qpidd.conf DESTINATION ${QPID_INSTALL_SASLDIR} diff --git a/cpp/etc/Makefile.am b/cpp/etc/Makefile.am index aa41c65b37..5d0059c536 100644 --- a/cpp/etc/Makefile.am +++ b/cpp/etc/Makefile.am @@ -40,7 +40,7 @@ endif # We can't use autoconf substitution directly because it leaves # ${prefix} and ${exec_prefix} unexpanded. Substitute with sed # scripts. -SUBST="s|!!sysconfdir!!|${sysconfdir}|;s|!!sbindir!!|${sbindir}|;s|!!bindir!!|${bindir}|" +SUBST="s|@sysconfdir[@]|${sysconfdir}|;s|@sbindir[@]|${sbindir}|;s|@bindir[@]|${bindir}|" qpidd: qpidd.in sed $(SUBST) $< > $@ qpidd-primary: qpidd-primary.in diff --git a/cpp/etc/qpidd-primary.in b/cpp/etc/qpidd-primary.in index 3088a643f2..ebb809dbf6 100755 --- a/cpp/etc/qpidd-primary.in +++ b/cpp/etc/qpidd-primary.in @@ -40,13 +40,13 @@ prog=qpidd # Source function library. . /etc/rc.d/init.d/functions -if [ -f /@sysconfdir@/sysconfig/$prog ] ; then - . /@sysconfdir@/sysconfig/$prog +if [ -f @sysconfdir@/sysconfig/$prog ] ; then + . @sysconfdir@/sysconfig/$prog fi # The following variables can be overridden in @sysconfdir@/sysconfig/$prog [[ $QPID_PORT ]] || QPID_PORT=5672 -[[ $QPID_HA ]] || QPID_HA=/@bindir@/qpid-ha +[[ $QPID_HA ]] || QPID_HA=@bindir@/qpid-ha export QPID_PORT RETVAL=0 diff --git a/cpp/etc/qpidd.in b/cpp/etc/qpidd.in index 2b43625b7d..91448add02 100755 --- a/cpp/etc/qpidd.in +++ b/cpp/etc/qpidd.in @@ -40,8 +40,8 @@ lockfile=/var/lock/subsys/$prog pidfile=/var/run/qpidd.pid # Source configuration -if [ -f !!sysconfdir!!/sysconfig/$prog ] ; then - . !!sysconfdir!!/sysconfig/$prog +if [ -f @sysconfdir@/sysconfig/$prog ] ; then + . @sysconfdir@/sysconfig/$prog fi # Source function library. @@ -50,8 +50,8 @@ fi RETVAL=0 #ensure binary is present and executable -if [[ !(-x !!sbindir!!/$prog) ]] ; then - echo "!!sbindir!!/$prog not found or not executable" +if [[ !(-x @sbindir@/$prog) ]] ; then + echo "@sbindir@/$prog not found or not executable" exit 5 fi @@ -65,7 +65,7 @@ fi start() { [[ $QPID_DATA_DIR ]] || QPID_DATA_DIR=/var/lib/qpidd echo -n $"Starting Qpid AMQP daemon: " - daemon --pidfile $pidfile --check $prog --user qpidd !!sbindir!!/$prog --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS + daemon --pidfile $pidfile --check $prog --user qpidd @sbindir@/$prog --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile @@ -73,7 +73,7 @@ start() { touch $pidfile chown qpidd.qpidd $pidfile [ -x /sbin/restorecon ] && /sbin/restorecon $pidfile - runuser - -s /bin/sh qpidd -c "!!sbindir!!/$prog --check > $pidfile" + runuser - -s /bin/sh qpidd -c "@sbindir@/$prog --check > $pidfile" fi return $RETVAL } -- cgit v1.2.1