From 97df5ec9a646591e735863e012135dfbeb567765 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 8 Oct 2014 04:32:48 -0400 Subject: [PATCH] In ubuntu, rpm can be installed, if rpm is installed,ubuntu will use rpm instead of dpkg,so check dpkg first --- xCAT/postscripts/otherpkgs | 45 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 6d3e771c8..2845b5130 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -396,31 +396,36 @@ hasdpkg=0 supdatecommand="rpm -Uvh --replacepkgs" sremovecommand="rpm -ev" -result=`rpm --version 2>/dev/null` +#In ubuntu, rpm can be installed, if rpm is installed,ubuntu will use rpm +#So dpkg --version should be in front of rpm --version +result=`dpkg --version 2>/dev/null` if [ $? -eq 0 ]; then - hasrpm=1 - result=`rpm -q yum` - if [ $? -eq 0 ]; then - hasyum=1 - else - result=`rpm -q zypper` - if [ "$?" = "0" ]; then - haszypper=1 - fi - fi -else - result=`dpkg --version` + hasdpkg=1 + supdatecommand="dpkg -i" + sremovecommand="dpkg -r" + result=`dpkg -l apt` if [ $? -eq 0 ]; then - hasdpkg=1 - supdatecommand="dpkg -i" - sremovecommand="dpkg -r" - result=`dpkg -l apt` - if [ $? -eq 0 ]; then - hasapt=1 - fi + hasapt=1 + fi +else + result=`rpm --version 2>/dev/null` + if [ $? -eq 0 ]; then + hasrpm=1 + result=`rpm -q yum` + if [ $? -eq 0 ]; then + hasyum=1 + else + result=`rpm -q zypper` + if [ "$?" = "0" ]; then + haszypper=1 + fi + fi fi fi + + + ########### ##start generating the os pkg repositories if ( pmatch "$OSVER" "sles11*" && [ $haszypper -eq 1 ] ); then