Skip to content

Commit 36445bc

Browse files
author
Ken Gaillot
committed
Build: configure: add --with-runstatedir option
... and use it where appropriate.
1 parent 3d88562 commit 36445bc

File tree

5 files changed

+43
-14
lines changed

5 files changed

+43
-14
lines changed

configure.ac

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ AC_ARG_WITH([bundledir],
295295
[ CRM_BUNDLE_DIR="$withval" ]
296296
)
297297

298+
dnl The not-yet-released autoconf 2.70 will have a --runstatedir option.
299+
dnl Until that's available, emulate it with our own --with-runstatedir.
300+
pcmk_runstatedir=""
301+
AC_ARG_WITH([runstatedir],
302+
[AS_HELP_STRING([--with-runstatedir=DIR],
303+
[modifiable per-process data @<:@LOCALSTATEDIR/run@:>@ (ignored if --runstatedir is available)])],
304+
[ pcmk_runstatedir="$withval" ]
305+
)
306+
298307
dnl This defaults to /usr/lib rather than libdir because it's determined by the
299308
dnl OCF project and not pacemaker. Even if a user wants to install pacemaker to
300309
dnl /usr/local or such, the OCF agents will be expected in their usual
@@ -449,6 +458,19 @@ eval infodir="`eval echo ${infodir}`"
449458
eval mandir="`eval echo ${mandir}`"
450459

451460
dnl Home-grown variables
461+
462+
if [ test "x${runstatedir}" = "x" ]; then
463+
if [ test "x${pcmk_runstatedir}" = "x" ]; then
464+
runstatedir="${localstatedir}/run"
465+
else
466+
runstatedir="${pcmk_runstatedir}"
467+
fi
468+
fi
469+
eval runstatedir="$(eval echo ${runstatedir})"
470+
AC_DEFINE_UNQUOTED([PCMK_RUN_DIR], ["$runstatedir"],
471+
[Location for modifiable per-process data])
472+
AC_SUBST(runstatedir)
473+
452474
eval INITDIR="${INITDIR}"
453475
eval docdir="`eval echo ${docdir}`"
454476
if test x"${docdir}" = x""; then
@@ -1189,10 +1211,6 @@ fi
11891211
AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Pacemaker daemons as)
11901212
AC_SUBST(CRM_DAEMON_GROUP)
11911213

1192-
CRM_STATE_DIR=${localstatedir}/run/crm
1193-
AC_DEFINE_UNQUOTED(CRM_STATE_DIR,"$CRM_STATE_DIR", Where to keep state files and sockets)
1194-
AC_SUBST(CRM_STATE_DIR)
1195-
11961214
CRM_PACEMAKER_DIR=${localstatedir}/lib/pacemaker
11971215
AC_DEFINE_UNQUOTED(CRM_PACEMAKER_DIR,"$CRM_PACEMAKER_DIR", Location to store directory produced by Pacemaker daemons)
11981216
AC_SUBST(CRM_PACEMAKER_DIR)
@@ -1217,11 +1235,12 @@ CRM_DAEMON_DIR="${libexecdir}/pacemaker"
12171235
AC_DEFINE_UNQUOTED(CRM_DAEMON_DIR,"$CRM_DAEMON_DIR", Location for Pacemaker daemons)
12181236
AC_SUBST(CRM_DAEMON_DIR)
12191237

1220-
HA_STATE_DIR="${localstatedir}/run"
1221-
AC_DEFINE_UNQUOTED(HA_STATE_DIR,"$HA_STATE_DIR", Where sbd keeps its PID file)
1222-
AC_SUBST(HA_STATE_DIR)
1238+
CRM_STATE_DIR="${runstatedir}/crm"
1239+
AC_DEFINE_UNQUOTED([CRM_STATE_DIR], ["$CRM_STATE_DIR"],
1240+
[Where to keep state files and sockets])
1241+
AC_SUBST(CRM_STATE_DIR)
12231242

1224-
CRM_RSCTMP_DIR="${localstatedir}/run/resource-agents"
1243+
CRM_RSCTMP_DIR="${runstatedir}/resource-agents"
12251244
AC_DEFINE_UNQUOTED(CRM_RSCTMP_DIR,"$CRM_RSCTMP_DIR", Where resource agents should keep state files)
12261245
AC_SUBST(CRM_RSCTMP_DIR)
12271246

daemons/pacemakerd/pacemakerd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool global_keep_tracking = false;
4646
static const char *local_name = NULL;
4747
static uint32_t local_nodeid = 0;
4848
static crm_trigger_t *shutdown_trigger = NULL;
49-
static const char *pid_file = "/var/run/pacemaker.pid";
49+
static const char *pid_file = PCMK_RUN_DIR "/pacemaker.pid";
5050

5151
typedef struct pcmk_child_s {
5252
int pid;

lib/common/watchdog.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
2-
* Copyright 2013 Lars Marowsky-Bree <lmb@suse.com>
3-
* 2014-2018 Andrew Beekhof <andrew@beekhof.net>
2+
* Copyright 2013-2019 the Pacemaker project contributors
3+
*
4+
* The version control history for this file may have further details.
45
*
56
* This source code is licensed under the GNU Lesser General Public License
67
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
@@ -181,7 +182,7 @@ pcmk_locate_sbd(void)
181182
}
182183

183184
/* Look for the pid file */
184-
pidfile = crm_strdup_printf("%s/sbd.pid", HA_STATE_DIR);
185+
pidfile = crm_strdup_printf(PCMK_RUN_DIR "/sbd.pid");
185186
sbd_path = crm_strdup_printf("%s/sbd", SBIN_DIR);
186187

187188
/* Read the pid file */

rpm/pacemaker.spec.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
%define gnutls_priorities %{?pcmk_gnutls_priorities}%{!?pcmk_gnutls_priorities:@SYSTEM}
7777
%endif
7878

79+
%if !%{defined _rundir}
80+
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1200
81+
%define _rundir /run
82+
%else
83+
%define _rundir /var/run
84+
%endif
85+
%endif
86+
7987
## Different distros name certain packages differently
8088
%if 0%{?suse_version} > 0
8189
%global pkgname_bzip2_devel libbz2-devel
@@ -484,6 +492,7 @@ export LDFLAGS_HARDENED_LIB="%{?_hardening_ldflags}"
484492
%{!?with_doc: --with-brand=} \
485493
%{?gnutls_priorities: --with-gnutls-priorities="%{gnutls_priorities}"} \
486494
--with-initdir=%{_initrddir} \
495+
--with-runstatedir=%{_rundir} \
487496
--localstatedir=%{_var} \
488497
--with-version=%{version}-%{release}
489498

tools/ipmiservicelogd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Jeff Zheng <Jeff.Zheng@Intel.com>
1111
*
1212
* Original copyright 2009 International Business Machines, IBM
13-
* Later changes copyright 2009-2018 the Pacemaker project contributors
13+
* Later changes copyright 2009-2019 the Pacemaker project contributors
1414
*
1515
* The version control history for this file may have further details.
1616
*
@@ -563,7 +563,7 @@ main(int argc, char *argv[])
563563
}
564564
#endif
565565

566-
crm_make_daemon("ipmiservicelogd", TRUE, "/var/run/ipmiservicelogd.pid0");
566+
crm_make_daemon("ipmiservicelogd", TRUE, PCMK_RUN_DIR "/ipmiservicelogd.pid0");
567567
crm_log_cli_init("ipmiservicelogd");
568568
// Maybe this should log like a daemon instead?
569569
// crm_log_init("ipmiservicelogd", LOG_INFO, TRUE, FALSE, argc, argv, FALSE);

0 commit comments

Comments
 (0)