From 786cfde0a82a9260b0ac6f2a1e79c88b167b19d1 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Sun, 7 Apr 2013 06:14:08 +0000 Subject: [PATCH] buildkit support on debian/ubuntu git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15842 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-buildkit/bin/buildkit | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index c10238649..20318323d 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -333,12 +333,24 @@ if ($::HELP) exit(0); } +my $debianflag = 0; +my $tempstring = xCAT::BuildKitUtils->osver(); +if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ + $debianflag = 1; +} + # display the version statement if -v or --version is specified if ($::VERSION) { - if ( system("rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit") ) { + my $versioncmd = "rpm -q --qf \"%{NAME}: %{VERSION}-%{RELEASE} \n\" xCAT-buildkit"; + my $message = "Error quering xCAT-buildkit rpm. Version info is not available. \n"; + if ( $debianflag ){ + $versioncmd = "dpkg-query --show -f='\${PackageSpec}: \${Version}\n' xcat-buildkit"; + $message = "Error quering xcat-buildkit pakcage. Version info is not available. \n"; + } + if ( system($versioncmd) ) { # non-zero return from system call - print "Error quering xCAT-buildkit rpm. Version info is not available. \n"; + print $message; exit 1; } exit 0; @@ -350,12 +362,6 @@ if ( ! $arg ) { exit (0); } -my $debianflag = 0; -my $tempstring = xCAT::BuildKitUtils->osver(); -if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ - $debianflag = 1; -} - while ($arg) { my $command = $arg; $command =~ tr/A-Z/a-z/; # convert to lowercase