summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glusterfsd/src/Makefile.am1
-rw-r--r--glusterfsd/src/glusterfsd.c13
-rw-r--r--glusterfsd/src/glusterfsd.h1
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--tests/basic/glusterfsd-args.t5
-rw-r--r--tests/env.rc.in3
6 files changed, 23 insertions, 1 deletions
diff --git a/glusterfsd/src/Makefile.am b/glusterfsd/src/Makefile.am
index 141a7108ae7..7b8d1dbf1fb 100644
--- a/glusterfsd/src/Makefile.am
+++ b/glusterfsd/src/Makefile.am
@@ -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 \
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 12f561eb689..5cc4704ac95 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -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.
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index 496a4d95352..72936371a55 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -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 {
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index faae3429c30..b046e0dd783 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -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;
diff --git a/tests/basic/glusterfsd-args.t b/tests/basic/glusterfsd-args.t
new file mode 100644
index 00000000000..2dd84b8c29e
--- /dev/null
+++ b/tests/basic/glusterfsd-args.t
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+EXPECT $GLUSTER_LIBEXECDIR glusterfsd --print-libexecdir
diff --git a/tests/env.rc.in b/tests/env.rc.in
index f78fe8ffeb5..8d692f7066c 100644
--- a/tests/env.rc.in
+++ b/tests/env.rc.in
@@ -34,3 +34,6 @@ export PYTHONPATH
GLUSTER_CMD_DIR=@sbindir@
export GLUSTER_CMD_DIR
+
+GLUSTER_LIBEXECDIR=@GLUSTERFS_LIBEXECDIR@
+export GLUSTER_LIBEXECDIR