Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ install-exec-local:
$(INSTALL) -d $(DESTDIR)/${boothsitedir}
$(INSTALL) -d $(DESTDIR)/${boothocfdir}
$(INSTALL) -d $(DESTDIR)/${SOCKETDIR}
$(INSTALL) -d $(DESTDIR)/${BOOTH_LIB_DIR} -m 750
-chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/${BOOTH_LIB_DIR}
$(INSTALL) -d $(DESTDIR)/${BOOTH_CORE_DIR} -m 750
-chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/${BOOTH_CORE_DIR}

install-exec-hook:
ln -sf ${sbindir}/boothd $(DESTDIR)/${sbindir}/booth
Expand All @@ -93,6 +97,8 @@ uninstall-local:
rmdir $(DESTDIR)/${bootharbitratordir} || :;
rmdir $(DESTDIR)/${boothsitedir} || :;
rmdir $(DESTDIR)/${SOCKETDIR} || :;
rmdir $(DESTDIR)/${BOOTH_CORE_DIR} || :;
rmdir $(DESTDIR)/${BOOTH_LIB_DIR} || :;

test: check

Expand Down
2 changes: 2 additions & 0 deletions booth.spec
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ echo "%%run_build_tests set to %run_build_tests; skipping tests"
%dir /usr/lib/ocf/lib
%dir /usr/lib/ocf/lib/booth
%dir %{_sysconfdir}/booth
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/
%dir %attr (750, %{uname}, %{gname}) %{_var}/lib/booth/cores
%{_sbindir}/rcbooth-arbitrator
/usr/lib/ocf/resource.d/pacemaker/booth-site
/usr/lib/ocf/lib/booth/geo_attr.sh
Expand Down
45 changes: 45 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,31 @@ cc_supports_flag() {
return $RC
}

## extract header or define
try_extract_header_define() {
AC_MSG_CHECKING(if $2 in $1 exists)
Cfile=$srcdir/extract_define.$2.${$}
printf "#include <stdio.h>\n" > ${Cfile}.c
printf "#include <%s>\n" $1 >> ${Cfile}.c
printf "int main(int argc, char **argv) {\n" >> ${Cfile}.c
printf "#ifdef %s\n" $2 >> ${Cfile}.c
printf "printf(\"%%s\", %s);\n" $2 >> ${Cfile}.c
printf "#endif \n return 0; }\n" >> ${Cfile}.c
$CC $CFLAGS ${Cfile}.c -o ${Cfile} 2>/dev/null
value=
if test -x ${Cfile}; then
value=`${Cfile} 2>/dev/null`
fi
if test x"${value}" == x""; then
value=$3
AC_MSG_RESULT(default: $value)
else
AC_MSG_RESULT($value)
fi
printf $value
rm -rf ${Cfile}.c ${Cfile} ${Cfile}.dSYM ${Cfile}.gcno
}

## cleanup
AC_MSG_NOTICE(Sanitizing prefix: ${prefix})
case $prefix in
Expand Down Expand Up @@ -316,6 +341,15 @@ if test "x$coredump_nursing" != "xno"; then
fi
AM_CONDITIONAL([COREDUMP_NURSING], [test "x$coredump_nursing" != "xno"])

# define CRM daemon user & group
CRM_DAEMON_USER=`try_extract_header_define glue_config.h HA_CCMUSER hacluster`
AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Booth daemon as)
AC_SUBST(CRM_DAEMON_USER)

CRM_DAEMON_GROUP=`try_extract_header_define glue_config.h HA_APIGROUP haclient`
AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Booth daemon as)
AC_SUBST(CRM_DAEMON_GROUP)

# OS detection
# THIS SECTION MUST DIE!
CP=cp
Expand Down Expand Up @@ -515,11 +549,19 @@ AC_SUBST([LINT_FLAGS])

AC_DEFINE_UNQUOTED([SOCKETDIR], "$(eval echo ${SOCKETDIR})", [Socket directory])

BOOTH_LIB_DIR=${localstatedir}/lib/booth
BOOTH_CORE_DIR=${localstatedir}/lib/booth/cores
BOOTHSYSCONFDIR=${sysconfdir}/booth

AC_SUBST([HAVE_LOG_CIB_DIFF])
AC_SUBST([HAVE_XML_LOG_PATCHSET])
AC_SUBST([BOOTH_LIB_DIR])
AC_SUBST([BOOTH_CORE_DIR])
AC_SUBST([BOOTHSYSCONFDIR])
AC_SUBST([BOOTH_BUILD_VERSION])

AC_DEFINE_UNQUOTED([BOOTH_LIB_DIR], "$(eval echo ${BOOTH_LIB_DIR})", [booth lib directory])
AC_DEFINE_UNQUOTED([BOOTH_CORE_DIR], "$(eval echo ${BOOTH_CORE_DIR})", [booth working directory])
AC_DEFINE_UNQUOTED([BOOTHSYSCONFDIR], "$(eval echo ${BOOTHSYSCONFDIR})", [booth config directory])

AC_DEFINE_UNQUOTED([PACKAGE_FEATURES], "${PACKAGE_FEATURES}", [booth built-in features])
Expand Down Expand Up @@ -548,6 +590,9 @@ AC_MSG_RESULT([ Logging provider = ${logging_provider}])
AC_MSG_RESULT([ Range2random provider = ${range2random_provider}])
AC_MSG_RESULT([ Nametag provider = ${nametag_provider}])
AC_MSG_RESULT([ Coredump nursing = ${coredump_nursing}])
AC_MSG_RESULT([ Working directory = ${BOOTH_CORE_DIR}])
AC_MSG_RESULT([ HA group name = ${CRM_DAEMON_GROUP}])
AC_MSG_RESULT([ HA user name = ${CRM_DAEMON_USER}])
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE build info:])
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
Expand Down
4 changes: 4 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,10 @@ static int do_server(int type)
}
cl_cdtocoredir();
prctl(PR_SET_DUMPABLE, (unsigned long)TRUE, 0UL, 0UL, 0UL);
#else
if (chdir(BOOTH_CORE_DIR) < 0) {
log_error("cannot change working directory to %s", BOOTH_CORE_DIR);
}
#endif

signal(SIGCHLD, (__sighandler_t)wait_child);
Expand Down