From bcb4eb6064dd552b9f6b4d5acdb9db7a2e903f89 Mon Sep 17 00:00:00 2001
From: Florent Rougon <f.rougon@free.fr>
Date: Tue, 3 Oct 2017 10:39:36 +0200
Subject: [PATCH] download_and_compile.sh: fix detection of whether dctrl-tools
 is installed

Typical output of:

  dpkg-query --showformat='${Status}\n' --show dctrl-tools

is:

  install ok installed

(three words, not one). Thanks to wkitty42 for the report.
---
 download_and_compile.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/download_and_compile.sh b/download_and_compile.sh
index e72b704..8729389 100755
--- a/download_and_compile.sh
+++ b/download_and_compile.sh
@@ -313,7 +313,7 @@ fi
 
 # Ensure 'dctrl-tools' is installed
 if [[ "$(dpkg-query --showformat='${db:Status-Status}\n' --show dctrl-tools \
-                    2>/dev/null)" != "installed" ]]; then
+                    2>/dev/null | awk '{print $3}') " != "installed" ]]; then
   if [[ "$DOWNLOAD_PACKAGES" = "y" ]]; then
     _aptInstall dctrl-tools
   else