diff options
author | Aravinda VK <avishwan@redhat.com> | 2018-08-17 09:38:39 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-09-05 06:44:59 +0000 |
commit | 560bd8671f2f9ae17530ad1d23a209dc95d41f82 (patch) | |
tree | 61b355b7eba5f8b8decfbdd2f2c64ac574fc30dc /glusterfsd | |
parent | 0590678d05473d40c8107be8cf5a66879f9d196f (diff) |
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>
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/Makefile.am | 1 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 13 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 1 |
3 files changed, 14 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 { |