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 {
|
2021-12-24 20:33:54 +00:00
|
|
|
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
|
2021-12-24 20:33:54 +00:00
|
|
|
_run "[$yay] Synchronizing package databases" $yay -Syy
|
2021-02-05 00:05:51 +00:00
|
|
|
__pacman_updated=yes
|
|
|
|
fi
|
2021-12-24 20:33:54 +00:00
|
|
|
_run "[$yay] Install $pkg" $yay -S --noconfirm $pkg
|
2021-02-05 00:05:51 +00:00
|
|
|
else
|
2021-12-24 20:33:54 +00:00
|
|
|
echo "[$yay] $pkg is already installed, skipping."
|
2021-02-05 00:05:51 +00:00
|
|
|
fi
|
|
|
|
}
|