Files
dotfiles/bin/.local/bin/pkg-install
2025-09-09 12:12:44 -04:00

26 lines
536 B
Bash

#!/bin/sh
pkgs="$@"
installer="echo \"error: something went wrong\" ; exit 1"
check() {
return command -v xbps-install >dev/null 2>&1
}
if check xbps-install; then
installer="sudo xbps-install -Syu"
elif check pacman; then
installer="sudo pacman -Syu"
elif check apt; then
installer="sudo apt install -y"
elif check dnf; then
installer="sudo dnf install -y"
elif check brew; then
installer="brew install"
else
echo "error: could not find package manager." ; exit 1
fi
$installer $pkgs && echo "done." && exit 0
exit 1