Fix if-statement for pkg retry loop 52/53052/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 9 Mar 2017 05:31:10 +0000 (00:31 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 9 Mar 2017 05:32:42 +0000 (00:32 -0500)
Refer to: https://github.com/koalaman/shellcheck/wiki/SC2181

Change-Id: I5df7b344ea2abc5aef6b675022125f14b22d0607
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
packer/provision/baseline.sh

index 06e0ba75d8bedd3ba42cc967faaf69c38f19c968..38b6ac2e066102d4e41fa7d7ddcedbf33217a6f9 100644 (file)
@@ -157,8 +157,8 @@ EOF
 
         for pkg in unzip xz-utils puppet git git-review libxml-xpath-perl
         do
-            if [ "$(dpkg-query -W -f='${Status}' $pkg 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
-              apt-get install $pkg;
+            if dpkg-query -W -f='${Status}' $pkg 2>/dev/null | grep -c "ok installed"; then
+                apt-get install $pkg
             fi
         done
     done