From 160e00edeeb49b531813a88c2041a4f9bd10c91b Mon Sep 17 00:00:00 2001 From: Ark74 Date: Thu, 21 Mar 2024 13:00:58 -0600 Subject: [PATCH] prepare_php.sh: add missing install_ifnot function --- tools/prepare_php.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/prepare_php.sh b/tools/prepare_php.sh index 070733c..a1f890a 100644 --- a/tools/prepare_php.sh +++ b/tools/prepare_php.sh @@ -18,6 +18,15 @@ if [ $# -ne 1 ]; then exit 1 fi +install_ifnot() { + if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" == "1" ]; then + echo " $1 is installed, skipping..." + else + printf "\n---- Installing %s ----" "$1" + apt-get -yq2 install "$1" + fi +} + install_aval_package() { for i in $1 do