From 578bbaabc259f4218769784b6e137a4c569039bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Mon, 29 Aug 2011 14:30:54 +0200 Subject: [PATCH] Added sssd --version option https://fedorahosted.org/sssd/ticket/953 --- configure.ac | 5 ++++- src/conf_macros.m4 | 11 +++++++++++ src/man/sssd.8.xml | 10 ++++++++++ src/monitor/monitor.c | 12 ++++++++++-- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 958fa14..d3f4758 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,9 @@ AM_GNU_GETTEXT_VERSION([0.14]) AC_SUBST([PRERELEASE_VERSION], PRERELEASE_VERSION_NUMBER) +AC_DEFINE([PRERELEASE_VERSION], "PRERELEASE_VERSION_NUMBER", + [Prerelease version number of package]) + AM_CONDITIONAL([GIT_CHECKOUT], [git log -1 &>/dev/null]) m4_pattern_allow([AM_SILENT_RULES]) @@ -71,6 +74,7 @@ AC_SUBST(pammoddir) m4_include([src/external/platform.m4]) m4_include(src/conf_macros.m4) +WITH_DISTRO_VERSION WITH_DB_PATH WITH_PLUGIN_PATH WITH_PID_PATH @@ -210,4 +214,3 @@ AC_CONFIG_FILES([Makefile contrib/sssd.spec src/examples/rwtab src/doxy.config src/sysv/systemd/sssd.service po/Makefile.in src/man/Makefile src/providers/ipa/ipa_hbac.pc src/providers/ipa/ipa_hbac.doxy]) AC_OUTPUT - diff --git a/src/conf_macros.m4 b/src/conf_macros.m4 index bd661ba..50cca8a 100644 --- a/src/conf_macros.m4 +++ b/src/conf_macros.m4 @@ -1,3 +1,14 @@ +AC_DEFUN([WITH_DISTRO_VERSION], + [ AC_ARG_WITH([distro-version], + [AC_HELP_STRING([--with-distro-version=VERSION], + [Distro version number []] + ) + ] + ) + AC_DEFINE_UNQUOTED(DISTRO_VERSION, "$with_distro_version", + [Distro version number]) + ]) + AC_DEFUN([WITH_DB_PATH], [ AC_ARG_WITH([db-path], [AC_HELP_STRING([--with-db-path=PATH], diff --git a/src/man/sssd.8.xml b/src/man/sssd.8.xml index 5fda3ad..8eba186 100644 --- a/src/man/sssd.8.xml +++ b/src/man/sssd.8.xml @@ -130,6 +130,16 @@ + + + + + + + Print version number and exit. + + + diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 799b7c6..f81018a 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2376,6 +2376,7 @@ int main(int argc, const char *argv[]) poptContext pc; int opt_daemon = 0; int opt_interactive = 0; + int opt_version = 0; char *opt_config_file = NULL; char *config_file = NULL; int flags = 0; @@ -2394,6 +2395,8 @@ int main(int argc, const char *argv[]) _("Run interactive (not a daemon)"), NULL}, \ {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \ _("Specify a non-default config file"), NULL}, \ + {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \ + _("Print version number and exit"), NULL }, \ POPT_TABLEEND }; @@ -2413,8 +2416,13 @@ int main(int argc, const char *argv[]) CONVERT_AND_SET_DEBUG_LEVEL(debug_level); - /* If the level, timestamps or microseconds was passed at the command-line, - * we want to save it and pass it to the children later. + if (opt_version) { + puts(VERSION""DISTRO_VERSION""PRERELEASE_VERSION); + return EXIT_SUCCESS; + } + + /* If the level or timestamps was passed at the command-line, we want + * to save it and pass it to the children later. */ cmdline_debug_level = debug_level; cmdline_debug_timestamps = debug_timestamps; -- 1.7.6