This commit is contained in:
pika 2025-05-24 01:10:34 +02:00
parent 8791de659c
commit ef04287336

View file

@ -122,26 +122,27 @@ run-silent() {
# if given an array, it checks if the command is available, and if not - installs all packages in that array one by one # if given an array, it checks if the command is available, and if not - installs all packages in that array one by one
check-and-install() { check-and-install() {
local pkg=$1 # local pkg=$1
# echo "DEBUG:: GOT ARRAY :: ${@}" # echo "DEBUG:: GOT ARRAY :: ${@}"
# INFO: if it's not a list, then just check and install the package.. # INFO: if it's not a list, then just check and install the package..
if [[ -z $2 ]]; then #
spin bold yellow "Installing $pkg" # if [[ -z $2 ]]; then
if ! command-exists "$pkg"; then # spin bold yellow "Installing $pkg"
if run --err err pkg-install "$pkg"; then # if ! command-exists "$pkg"; then
upclear # if run --err err pkg-install "$pkg"; then
check bold "$(pen green bold 'Installed') $pkg" # upclear
else # check bold "$(pen green bold 'Installed') $pkg"
upclear # else
throw "Something went wrong! Could not install $(pen bold red $pkg)" # upclear
echo-error "${err:-}" # throw "Something went wrong! Could not install $(pen bold red $pkg)"
fi # echo-error "${err:-}"
else # fi
upclear # else
check bold "$pkg $(pen grey bold 'was already installed')" # upclear
# echo_pkg deps "skipping $pkg - as it's ${RED}already installed.." # check bold "$pkg $(pen grey bold 'was already installed')"
fi # # echo_pkg deps "skipping $pkg - as it's ${RED}already installed.."
else # fi
# else
local pkglength="${#@}" local pkglength="${#@}"
# ─< else go though the list of items and do the same >─────────────────────────────────── # ─< else go though the list of items and do the same >───────────────────────────────────
pen grey "Packages to install: $(pen green bold $pkglength)" pen grey "Packages to install: $(pen green bold $pkglength)"
@ -161,7 +162,7 @@ check-and-install() {
check bold "$pkg $(pen grey bold 'was already installed')" check bold "$pkg $(pen grey bold 'was already installed')"
fi fi
done done
fi # fi
} }
# ─< Check if the user is root and set sudo variable if necessary >─────────────────────── # ─< Check if the user is root and set sudo variable if necessary >───────────────────────