dotfiles/symlinks/bin/update-all-packages

84 lines
1.3 KiB
Plaintext
Raw Normal View History

2021-01-07 08:09:41 +00:00
#!/bin/bash
2022-05-09 11:00:44 +00:00
set -e
UNAME=$(sh -c 'uname 2>/dev/null || echo Unknown')
2021-01-07 08:09:41 +00:00
if type pacman > /dev/null 2>&1
then
# Clear out orphans
sudo pacman -Rns $(pacman -Qtdq)
# Update arch packages
sudo pacman -Syu
# Update AUR packages
2022-05-09 16:02:15 +00:00
aurfetch update-all -q
2021-01-07 08:09:41 +00:00
fi
if type apt > /dev/null 2>&1
then
# Clear out orphans
sudo apt autoremove
# Update apt packages
sudo apt update
sudo apt full-upgrade
# Clear out orphans
sudo apt autoremove
fi
if type flatpak > /dev/null 2>&1
then
# Clear out unused flatpak apps
flatpak uninstall --unused
# Update flatpak packages
flatpak update
# Clear out unused flatpak apps once again
flatpak uninstall --unused
fi
# Update rubygems
2022-05-09 11:00:44 +00:00
if type gem > /dev/null 2>&1
then
gem update --system
gem update
fi
2021-01-07 08:09:41 +00:00
2022-05-09 11:00:44 +00:00
if type nvim > /dev/null 2>&1
then
nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
fi
if type -f vim > /dev/null 2>&1
then
command vim +PlugUpdate +qall
fi
if type asdf > /dev/null 2>&1
then
asdf update
asdf plugin-update --all
fi
if type brew > /dev/null 2>&1
then
brew update
brew upgrade
if [ "$UNAME" = "Darwin" ]; then
brew upgrade --cask
fi
if [ $? -eq 0 ]; then
echo $( date +%s ) > $MY_CONFIG_CACHE_DIR/brew-upgrade-date
fi
fi
2021-01-07 08:09:41 +00:00
if type pacman > /dev/null 2>&1
then
# Clear out orphans once again
sudo pacman -Rns $(pacman -Qtdq)
fi