dotfiles/recipes/_arch

34 lines
903 B
Text
Raw Normal View History

2021-02-05 00:05:51 +00:00
#!/bin/bash
# Description: Arch Package Manager
set -e
function _pacman {
local pkg=$1
if ! pacman -Qi $pkg >/dev/null 2>&1; then
if [ -z "$__pacman_updated" ]; then
_run "[pacman] Synchronizing package databases" sudo pacman -Syy
__pacman_updated=yes
fi
_run "[pacman] Install $pkg" sudo pacman -S --noconfirm $pkg
else
echo "[pacman] $pkg is already installed, skipping."
fi
}
function _yay {
local yay=yay
if command -v paru &>/dev/null; then
yay=paru
fi
2021-02-05 00:05:51 +00:00
local pkg=$1
if ! yay -Qi $pkg >/dev/null 2>&1; then
if [ -z "$__yay_updated" ]; then
_run "[$yay] Synchronizing package databases" $yay -Syy
2021-02-05 00:05:51 +00:00
__pacman_updated=yes
fi
_run "[$yay] Install $pkg" $yay -S --noconfirm $pkg
2021-02-05 00:05:51 +00:00
else
echo "[$yay] $pkg is already installed, skipping."
2021-02-05 00:05:51 +00:00
fi
}