New flag to glusterfsd binary to print libexec dir

New CLI option for `glusterfsd` binary to get the path of
libexec directory. This helps glusterd2 to detect the
installed path of `gsyncd` and other binaries.

Usage: `glusterfsd --print-libexecdir`

Updates: bz#1193929
Change-Id: I8c1a74afd9acec7ee7bd3deabed9d9f20fe3fb5f
Signed-off-by: Aravinda VK <avishwan@redhat.com>
This commit is contained in:
Aravinda VK 2018-08-17 09:38:39 +05:30 committed by Amar Tumballi
parent 0590678d05
commit 560bd8671f
6 changed files with 23 additions and 1 deletions

View File

@ -21,6 +21,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_srcdir)/libglusterfs/src -DDATADIR=\"$(localstatedir)\" \
-DCONFDIR=\"$(sysconfdir)/glusterfs\" $(GF_GLUSTERFS_CFLAGS) \
-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
-DLIBEXECDIR=\"$(GLUSTERFS_LIBEXECDIR)\"\
-I$(top_srcdir)/rpc/rpc-lib/src \
-I$(top_srcdir)/rpc/xdr/src \
-I$(top_builddir)/rpc/xdr/src \

View File

@ -173,6 +173,8 @@ static struct argp_option gf_options[] = {
"Print directory path in which statedumps shall be generated"},
{"print-logdir", ARGP_PRINT_LOGDIR_KEY, 0, OPTION_ARG_OPTIONAL,
"Print path of default log directory"},
{"print-libexecdir", ARGP_PRINT_LIBEXECDIR_KEY, 0, OPTION_ARG_OPTIONAL,
"Print path of default libexec directory"},
{"volfile-max-fetch-attempts", ARGP_VOLFILE_MAX_FETCH_ATTEMPTS, "0",
OPTION_HIDDEN, "Maximum number of attempts to fetch the volfile"},
@ -974,6 +976,10 @@ parse_opts (int key, char *arg, struct argp_state *state)
cmd_args->print_logdir = _gf_true;
break;
case ARGP_PRINT_LIBEXECDIR_KEY:
cmd_args->print_libexecdir = _gf_true;
break;
case ARGP_MAC_COMPAT_KEY:
if (!arg)
arg = "on";
@ -2076,7 +2082,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
argp_parse (&argp, argc, argv, ARGP_IN_ORDER, NULL, cmd_args);
if (cmd_args->print_xlatordir || cmd_args->print_statedumpdir ||
cmd_args->print_logdir) {
cmd_args->print_logdir || cmd_args->print_libexecdir) {
/* Just print, nothing else to do */
goto out;
}
@ -2694,6 +2700,11 @@ main (int argc, char *argv[])
goto out;
}
if (cmd->print_libexecdir) {
printf ("%s\n", LIBEXECDIR);
goto out;
}
if (cmd->print_netgroups) {
/* If this option is set we want to print & verify the file,
* set the return value (exit code in this case) and exit.

View File

@ -107,6 +107,7 @@ enum argp_option_keys {
ARGP_PRINT_LOGDIR_KEY = 185,
ARGP_KERNEL_WRITEBACK_CACHE_KEY = 186,
ARGP_ATTR_TIMES_GRANULARITY_KEY = 187,
ARGP_PRINT_LIBEXECDIR_KEY = 188,
};
struct _gfd_vol_top_priv {

View File

@ -483,6 +483,7 @@ struct _cmd_args {
int print_xlatordir;
int print_statedumpdir;
int print_logdir;
int print_libexecdir;
/* advanced options */
uint32_t volfile_server_port;
char *volfile_server_transport;

View File

@ -0,0 +1,5 @@
#!/bin/bash
. $(dirname $0)/../include.rc
EXPECT $GLUSTER_LIBEXECDIR glusterfsd --print-libexecdir

View File

@ -34,3 +34,6 @@ export PYTHONPATH
GLUSTER_CMD_DIR=@sbindir@
export GLUSTER_CMD_DIR
GLUSTER_LIBEXECDIR=@GLUSTERFS_LIBEXECDIR@
export GLUSTER_LIBEXECDIR