From 69a14d6c8a0dbd3ed8160dd7c4ad7ad290a3fb14 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Thu, 22 Aug 2024 17:11:59 +0200 Subject: [PATCH] chore: Update ensure_packages_installed function to prompt for sudo privileges before installing packages not always --- bin/helpers/packages.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/helpers/packages.sh b/bin/helpers/packages.sh index a59099e..b7460e3 100644 --- a/bin/helpers/packages.sh +++ b/bin/helpers/packages.sh @@ -44,8 +44,6 @@ packages=( ) ensure_packages_installed() { - ensure_sudo_privileges "In order to install packages, please provide your password:" - # Check if packages array contains duplicates if [ $(echo $packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then printfe "%s\n" "red" "The packages array contains duplicates" @@ -59,6 +57,8 @@ ensure_packages_installed() { # If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed if [ -z $pkg_status ]; then + ensure_sudo_privileges "In order to install packages, please provide your password:" + printfe "%s" "yellow" "Installing $package..." echo -en "\r"