From 3013d8778332936e0500290e4f1f5c8e3de51066 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:05:16 -0500 Subject: [PATCH] Add -v --version command line param to zmpkg.pl --- scripts/zmpkg.pl.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in index cdbca5dba..084747bad 100644 --- a/scripts/zmpkg.pl.in +++ b/scripts/zmpkg.pl.in @@ -47,15 +47,20 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; logInit(); my $command = $ARGV[0]; +if ( $command eq 'version' ) { + print ZoneMinder::Base::ZM_VERSION . "\n"; + exit(0); +} my $state; -my $dbh = zmDbConnect(); +my $dbh; -if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) +if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot|version)$/ ) { if ( $command ) { + $dbh = zmDbConnect(); # Check to see if it's a valid run state my $sql = 'select * from States where Name = ?'; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); @@ -78,10 +83,11 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) } if ( !$command ) { - print( "Usage: zmpkg.pl \n" ); + print( "Usage: zmpkg.pl \n" ); exit( -1 ); } } +$dbh = zmDbConnect() if ! $dbh; # Move to the right place chdir( $Config{ZM_PATH_WEB} ) or Fatal( "Can't chdir to '".$Config{ZM_PATH_WEB}."': $!" );