]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: use "apt" for checking install status
authorKefu Chai <kchai@redhat.com>
Mon, 23 Dec 2019 08:45:42 +0000 (16:45 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 23 Dec 2019 17:22:07 +0000 (01:22 +0800)
as "dpkg -s <package-name>" always returns 0 even if the <package> is
removed.

Signed-off-by: Kefu Chai <kchai@redhat.com>
install-deps.sh

index 7fdc0209cf24f004686d705b21ceb3798eba11ee..f141f6f1596c4c08948af12481cb68e3144a2839 100755 (executable)
@@ -139,7 +139,7 @@ function install_pkg_on_ubuntu {
        missing_pkgs="$@"
     else
        for pkg in $pkgs; do
-           if ! dpkg -s $pkg &> /dev/null; then
+           if ! apt -qq list $pkg 2>/dev/null | grep -q installed; then
                missing_pkgs+=" $pkg"
            fi
        done
@@ -154,7 +154,7 @@ function install_pkg_on_ubuntu {
 
 function install_boost_on_ubuntu {
     local codename=$1
-    if dpkg -s ceph-libboost1.67-dev &> /dev/null; then
+    if apt -qq list ceph-libboost1.67-dev 2>/dev/null | grep -q installed; then
        $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove 'ceph-libboost.*1.67.*'
        $SUDO rm /etc/apt/sources.list.d/ceph-libboost1.67.list
     fi