add --version option

This commit is contained in:
Johannes 'josch' Schauer 2019-02-23 08:55:31 +01:00
parent d73b8396ac
commit a91a825e67
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 22 additions and 0 deletions

View file

@ -224,6 +224,21 @@ else
./run_null.sh
fi
print_header "test --version"
cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
$CMD --version | egrep --quiet '^mmdebstrap [0-9](\.[0-9])+$'
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh
elif [ "$defaultmode" = "root" ]; then
./run_null.sh SUDO
else
./run_null.sh
fi
print_header "mode=root,variant=apt: create directory"
cat << END > shared/test.sh
#!/bin/sh

View file

@ -15,6 +15,8 @@
use strict;
use warnings;
our $VERSION = '0.3.0';
use English;
use Getopt::Long;
use Pod::Usage;
@ -1699,6 +1701,7 @@ sub main() {
Getopt::Long::Configure ('default', 'bundling', 'auto_abbrev', 'ignore_case_always');
GetOptions(
'h|help' => sub { pod2usage(-exitval => 0, -verbose => 2) },
'version' => sub { print STDOUT "mmdebstrap $VERSION\n"; exit 0; },
'components=s' => \$options->{components},
'variant=s' => \$options->{variant},
'include=s' => \$options->{include},
@ -2445,6 +2448,10 @@ require a double dash and may be abbreviated to uniqueness.
Print this help text and exit.
=item B<--version>
Print the B<mmdebstrap> version and exit.
=item B<--variant>=I<name>
Choose which package set to install. Valid variant I<name>s are B<extract>,