Browse Source

verbose

master
pvincent 3 years ago
parent
commit
736c271d18
  1. 10
      lib/functions.sh

10
lib/functions.sh

@ -1,10 +1,14 @@
#!/bin/bash
# idempotent apt install [package1 package2 ...]
function idem_apt_install() {
for i in $@; do
[ -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
sudo apt install -y "$i"
else
$VERBOSE && echo "${PREFIX:=}apt package <$i> already installed!"
elif $VERBOSE; then
echo "${PREFIX:=}apt package <$i> already installed!"
fi
done
}

Loading…
Cancel
Save