92 lines
1.7 KiB
Bash
Executable File
92 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
UNAME=$(sh -c 'uname 2>/dev/null || echo Unknown')
|
|
|
|
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
|
|
aurfetch update-all -q
|
|
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
|
|
if type gem > /dev/null 2>&1
|
|
then
|
|
gem update --system
|
|
gem update
|
|
fi
|
|
|
|
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
|
|
|
|
ASDF_INSTALLED_GLOBAL_PACKAGES=$(comm -12 <(cat $HOME/.tool-versions | cut -f1 -d ' ' | sort) <(asdf plugin list | sort))
|
|
ASDF_PACKAGES_TO_UPDATE=$(comm -3 <(echo "$ASDF_INSTALLED_GLOBAL_PACKAGES" | sort) <(printf "java\nruby" | sort))
|
|
echo $ASDF_PACKAGES_TO_UPDATE
|
|
for PKG in $ASDF_PACKAGES_TO_UPDATE; do
|
|
asdf install $PKG latest
|
|
asdf global $PKG $(asdf latest $PKG)
|
|
done
|
|
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
|
|
|
|
if type pacman > /dev/null 2>&1
|
|
then
|
|
# Clear out orphans once again
|
|
sudo pacman -Rns $(pacman -Qtdq)
|
|
fi
|