Compare commits

..

No commits in common. "922ce287d2d9f9991ff14dc0c8708cde77f0c51b" and "9b61028bf48116393e03f2663f248a30641ecb36" have entirely different histories.

2 changed files with 8 additions and 30 deletions

View File

@ -3,18 +3,10 @@
tag_file="$(mktemp)" tag_file="$(mktemp)"
trap 'rm "${tag_file}"' EXIT trap 'rm "${tag_file}"' EXIT
DEBUG="${DEBUG:-0}"
log() {
if [ "${DEBUG}" -gt 0 ]; then
printf "$@"
fi
}
add_tag() { add_tag() {
for tag in "$@"; do for tag in "$@"; do
if ! has_tags "$tag"; then if ! has_tags "$tag"; then
log "Adding detected tag: $tag\n" echo "Adding detected tag: $tag"
echo "${tag}" >> "${tag_file}" echo "${tag}" >> "${tag_file}"
fi fi
done done
@ -22,17 +14,17 @@ add_tag() {
has_tags() { has_tags() {
for req in "$@"; do for req in "$@"; do
log "Checking for tag: $req... " printf "Checking for tag: $req... "
detected=0 detected=0
while IFS= read -r line; do while IFS= read -r line; do
if [ "$line" = "$req" ]; then if [ "$line" = "$req" ]; then
log "yes\n" echo "yes"
detected=1 detected=1
break break
fi fi
done < "$tag_file" done < "$tag_file"
if [ "$detected" -eq 0 ]; then if [ "$detected" -eq 0 ]; then
log "no\n" echo "no"
return 1 return 1
fi fi
done done
@ -40,12 +32,12 @@ has_tags() {
} }
has_binary() { has_binary() {
log "Checking for binary: $1... " printf "Checking for binary: $1... "
if ! command -v "$1" >/dev/null 2>&1; then if ! command -v "$1" >/dev/null 2>&1; then
log "no\n" echo "no"
return 1 return 1
fi fi
log "yes\n" echo "yes"
return 0 return 0
} }

View File

@ -11,21 +11,7 @@ pacman_install() {
} }
yay_install() { yay_install() {
packages="" yay -S --noconfirm --needed "$@"
for package in "$@"; do
if ! pacman -Q "${package}" >/dev/null 2>&1; then
packages="${packages} ${package}"
fi
done
if [ ! -z "${packages}" ]; then
yay -S --noconfirm --needed ${packages}
fi
for package in "$@"; do
if ! pacman -Q "${package}" >/dev/null 2>&1; then
return 1 # at least one of the packages has not been correctly installed!
fi
done
return 0
} }
pacaur_install() { pacaur_install() {