From 1c3d308a99f0ff32d58276b2a5f250ad4ae337db Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 17 Jun 2022 19:00:46 +0400 Subject: [PATCH] fix: idem_apt_install detects uninstall --- lib/functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.sh b/lib/functions.sh index 7b193ec..1ef493c 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -5,7 +5,7 @@ function idem_apt_install() { [ -z "${VERBOSE:-}" ] && VERBOSE=false # || echo "VERBOSE is set to $VERBOSE" for i in "$@"; do - if ! (/usr/bin/dpkg-query --status "$i" >/dev/null 2>&1); then + if ! dpkg -l "$i" 2>/dev/null | grep -q ^ii; then sudo apt install -y "$i" elif $VERBOSE; then echo "apt package <$i> already installed!"