update pk for better existence

This commit is contained in:
Barak Michener 2020-07-24 13:04:56 -07:00
parent 6a49e78789
commit e05610d6cc

32
bin/pk
View file

@ -1,42 +1,48 @@
#!/bin/sh #!/bin/sh
search () { search () {
shift shift
if which pacman >/dev/null; then if command -v pacman &> /dev/null; then
pacman -Ss $1 || yay -Ss $1 pacman -Ss $1 || yay -Ss $1
elif which port >/dev/null; then elif command -v dnf &> /dev/null; then
dnf search $1
elif command -v port &> /dev/null; then
port search $1 port search $1
elif which portmaster >/dev/null; then elif command -v portmaster &> /dev/null; then
cd /usr/ports cd /usr/ports
make search name=$1 | grep "^\(Port\|Path\|Info\|Moved\|$\)" make search name=$1 | grep "^\(Port\|Path\|Info\|Moved\|$\)"
elif which aptitude >/dev/null; then elif command -v aptitude &> /dev/null; then
aptitude search $1 aptitude search $1
elif which apt-cache >/dev/null; then elif command -v apt-cache &> /dev/null; then
apt-cache search $1 apt-cache search $1
fi fi
} }
update () { update () {
shift shift
if which pacman >/dev/null; then if command -v pacman &> /dev/null; then
sudo pacman -Sy sudo pacman -Sy
elif which port >/dev/null; then elif command -v dnf &> /dev/null; then
sudo dnf update
elif command -v port &> /dev/null; then
sudo port selfupdate sudo port selfupdate
elif which portmaster >/dev/null; then elif command -v portsnap &> /dev/null; then
sudo portsnap fetch && sudo portsnap upgrade sudo portsnap fetch && sudo portsnap upgrade
elif which apt-get >/dev/null; then elif command -v apt-get &> /dev/null; then
sudo apt-get update sudo apt-get update
fi fi
} }
install () { install () {
shift shift
if which pacman >/dev/null; then if command -v pacman &> /dev/null; then
sudo pacman -S $* || yay -S $* sudo pacman -S $* || yay -S $*
elif which port >/dev/null; then elif command -v dnf &> /dev/null; then
sudo dnf install $*
elif command -v port &> /dev/null; then
sudo port install $* sudo port install $*
elif which portmaster >/dev/null; then elif command -v portmaster &> /dev/null; then
sudo portmaster $* sudo portmaster $*
elif which apt-get >/dev/null; then elif command -v apt-get &> /dev/null; then
sudo apt-get install $* sudo apt-get install $*
fi fi
} }