dotfiles/dot_local/bin/executable_update-all

44 lines
1.2 KiB
Bash

#!/bin/sh
## Here be dragons
# If paru is installed this script will update an Arch or Arch-based system,
# including AUR packages, without asking for confirmation. Never use it if you
# don't know how it will impact your system. For more information on safely
# updating see: https://wiki.archlinux.org/title/System_maintenance#Upgrading_the_system
alias paru='paru --noconfirm --skipreview'
alias zigup='zigup --install-dir "${HOME}/.local/share/zigup" --path-link "${HOME}/.local/bin/zig"'
updates=$(checkupdates)
aur_updates=$(paru -Qua)
rust_has_update=$(rustup check | grep -c 'Update')
if [ "$updates" = "" ] \
&& [ "$aur_updates" = "" ] \
&& [ "$rust_has_update" -eq 0 ];
then
echo "System is already up to date."
exit 0
fi
river_has_update=$(echo "$aur_updates" | grep -c 'river-git')
zls_has_update=$(echo "$aur_updates" | grep -c 'zls-git')
if [ "$rust_has_update" -ne 0 ]; then
rustup update
fi
if [ "$river_has_update" -ne 0 ] && [ "$zls_has_update" -ne 0 ]; then
zigup 0.13.0
paru -Syu river-git --ignore zls-git
zigup master
paru -S zls-git
elif [ "$river_has_update" -ne 0 ]; then
zigup 0.13.0
paru -Syu
zigup master
else
zigup master
paru -Syu
fi