You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
8.2 KiB
Fish

function pmm
set y 0
set u 0
set nc 0
set ins 0
set pkgs
for i in $argv
if test "$ins" = "1"
set pkgs $pkgs $i
end
if test "$i" = "update"
set y 1
end
if test "$i" = "upgrade"
set u 1
end
if test "$i" = "install"
set ins 1
end
if test "$i" = "--noconfirm"
set nc 1
end
end
if test "$y" = "1"
for j in (brl list)
if strat $j apt --version > /dev/null 2>&1
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat -r $j apt update &
end
end
for j in (brl list)
if strat $j pacman --version > /dev/null 2>&1
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat -r $j pacman -Sy &
end
end
for j in (brl list)
if strat $j xbps-install --version > /dev/null 2>&1
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat -r $j xbps-install -S &
end
end
for j in (brl list)
if strat $j dnf --version > /dev/null 2>&1
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat -r $j dnf check-update &
end
end
for j in (brl list)
if strat $j emerge --version > /dev/null 2>&1
echo "Updating the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat -r $j emerge --sync &
end
end
while jobs -q
wait (jobs -p)
end
end
if test "$u" = "1"
for j in (brl list)
if strat $j apt --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j apt upgrade $ncarg
end
end
for j in (brl list)
if strat $j pacman --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg --noconfirm
else
set ncarg
end
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j pacman -Su $ncarg
end
end
for j in (brl list)
if strat $j xbps-install --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j xbps-install -u $ncarg
end
end
for j in (brl list)
if strat $j dnf --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j dnf distro-sync $ncarg
end
end
for j in (brl list)
if strat $j emerge --version > /dev/null 2>&1
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j emerge -uDU --keep-going --with-bdeps=y @world
end
end
for j in (brl list)
if strat $j swupd --version > /dev/null 2>&1
echo "Upgrading the"(set_color green) "$j"(set_color normal) "stratum."
sudo strat $j swupd update
end
end
echo "Upgrading the"(set_color green) "bedrock"(set_color normal) "stratum."
sudo brl update
end
if test "$ins" = "1"
for j in (brl list)
if strat $j apt --version > /dev/null 2>&1
echo "Searching the"(set_color green) "$j"(set_color normal) "stratum."
set this 1
for k in $pkgs
if test -z (strat $j apt list "$k" 2>/dev/null | awk -F'/' 'NR>1{print $1}')
set this
end
end
if test -n "$this"
set stratas $stratas $j
end
end
end
for j in (brl list)
if strat $j pacman --version > /dev/null 2>&1
echo "Searching the"(set_color green) "$j"(set_color normal) "stratum."
set this 1
for k in $pkgs
if test -z (strat $j pacman -Ss "$k" | grep "/$k ")
set this
end
end
if test -n "$this"
set stratas $stratas $j
end
end
end
for j in (brl list)
if strat $j dnf --version > /dev/null 2>&1
echo "Searching the"(set_color green) "$j"(set_color normal) "stratum."
set this 1
for k in $pkgs
if strat $j dnf list "$k" > /dev/null 2>&1
set this 1
else
set this
end
end
if test -n "$this"
set stratas $stratas $j
end
end
end
for j in (brl list)
if strat $j xbps-install --version > /dev/null 2>&1
echo "Searching the"(set_color green) "$j"(set_color normal) "stratum."
set this 1
for k in $pkgs
if strat $j xbps-query -Rs $k | grep "] $k-" > /dev/null 2>&1
set this 1
else
set this
end
end
if test -n "$this"
set stratas $stratas $j
end
end
end
set chosen (echo $stratas | smenu -T -d -m "Select strata to install from: (Use t to select multiple)" -n 0 | tr " " "\n")
for stratum in $chosen
if strat $stratum apt --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
sudo strat $stratum apt install $pkgs $ncarg
end
if strat $stratum pacman --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg --noconfirm
else
set ncarg
end
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
sudo strat $stratum pacman -S $pkgs $ncarg
end
if strat $stratum xbps-install --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
sudo strat $stratum xbps-install $pkgs $ncarg
end
if strat $stratum dnf --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
sudo strat $stratum dnf install $pkgs $ncarg
end
if strat $stratum emerge --version > /dev/null 2>&1
if test "$nc" = "1"
set ncarg -y
else
set ncarg
end
echo "Installing $pkgs from the"(set_color green) "$stratum"(set_color normal) "stratum."
sudo strat $stratum emerge $pkgs $ncarg
end
end
end
end