From b8432d98626bb17e4b799014d10f728e9297c6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Olivier?= <aurelien@aolivier.eu> Date: Sat, 30 Jun 2018 00:32:51 +0200 Subject: [PATCH] New option "--version" At build time, we use the version number provided by configure.ac, which is updated upstream when there is a new release. --- man/backupninja.1 | 5 ++++- src/Makefile.am | 3 ++- src/backupninja.in | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/man/backupninja.1 b/man/backupninja.1 index 84508f6d..cce4c342 100644 --- a/man/backupninja.1 +++ b/man/backupninja.1 @@ -21,7 +21,7 @@ BACKUPNINJA \- A lightweight, extensible meta-backup system .I "a silent flower blossom death strike to lost data." .SH SYNOPSIS -.B "backupninja [ \-h ] [ \-d ] [ \-n ] [ \-t ] [ \-f filename ] [ \-\-run filename ]" +.B "backupninja [ \-h ] [ \-v ] [ \-d ] [ \-n ] [ \-t ] [ \-f filename ] [ \-\-run filename ]" .br .SH DESCRIPTION .B Backupninja @@ -71,6 +71,9 @@ burn CD/DVDs or create ISOs. .B \-h, \-\-help Show summary of options .TP +.B \-v, \-\-version +Show backupninja version number +.TP .B \-d, \-\-debug Run in debug mode, where all log messages are output to the current shell. .TP diff --git a/src/Makefile.am b/src/Makefile.am index 5694e9af..4f4680af 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,8 @@ edit = sed \ -e 's,@datadir\@,$(pkgdatadir),g' \ -e "s,@libdir\@,$(pkglibdir),g" \ -e 's,@localstatedir\@,$(localstatedir),g' \ - -e 's,@prefix\@,$(prefix),g' + -e 's,@prefix\@,$(prefix),g' \ + -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' #install-exec-hook: diff --git a/src/backupninja.in b/src/backupninja.in index 756c6781..8814df6d 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -278,6 +278,7 @@ script is run hourly from cron. The following options are available: -h, --help This usage message +-v, --version Show backupninja version number -d, --debug Run in debug mode, where all log messages are output to the current shell. -f, --conffile FILE Use FILE for the main configuration instead @@ -431,12 +432,14 @@ function process_action() { setupcolors conffile="@CFGDIR@/backupninja.conf" loglevel=3 +version="@PACKAGE_VERSION@" ## process command line options while [ $# -ge 1 ]; do case $1 in -h|--help) usage;; + -v|--version) echo "backupninja $version";; -d|--debug) debug=1; export BACKUPNINJA_DEBUG=yes;; -t|--test) test=1;debug=1;; -n|--now) processnow=1;; -- GitLab