From 4a8d4dec2a2458a3eb4f7c3a785f447fef24422d Mon Sep 17 00:00:00 2001 From: Buck Evan Date: Sun, 10 Jun 2018 15:53:52 -0700 Subject: [PATCH] get-stack: check deps before sudo Don't need to invoke sudo if all deps are already installed. Avoiding the sudo prompt where possible is going to be an improvement. --- etc/scripts/get-stack.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/scripts/get-stack.sh b/etc/scripts/get-stack.sh index 8433e0064e..77a6c26182 100755 --- a/etc/scripts/get-stack.sh +++ b/etc/scripts/get-stack.sh @@ -561,7 +561,9 @@ try_install_pkgs() { # Install packages using apt-get apt_get_install_pkgs() { - if ! sudocmd apt-get install -y ${QUIET:+-qq} "$@"; then + if dpkg-query -W "$@" > /dev/null; then + info "Already installed!" + elif ! sudocmd apt-get install -y ${QUIET:+-qq} "$@"; then die "Installing apt packages failed. Please run 'apt-get update' and try again." fi }