config/shell/functions/u: make it a lot more reliable

This commit is contained in:
xeruf 2022-08-08 22:05:24 +03:00
parent 5c2f91ced2
commit ef6581bde3
1 changed files with 14 additions and 9 deletions

View File

@ -213,19 +213,24 @@ del() {
} }
u() { u() {
which pacman-mirrors >/dev/null && if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d' ' -f1)" != "$(date +%F)"
then which pacman-mirrors >/dev/null &&
sudo pacman-mirrors --geoip sudo pacman-mirrors --geoip
which pacman >/dev/null && if which pacman >/dev/null; then
sudo pacman -Syyu --needed gnupg archlinux-keyring sudo pacman -Syy --needed base gnupg archlinux-keyring
#sudo pacman-key --populate archlinux && sudo pacman-key --populate
#sudo pacman-key --refresh-keys sudo pacman-key --refresh-keys
fi
fi
if which topgrade >/dev/null if which topgrade >/dev/null
then then
topgrade topgrade
test -d "$XDG_CONFIG_HOME/emacs" && if test -d "$XDG_CONFIG_HOME/emacs"
builtin cd $XDG_CONFIG_HOME/emacs && then
git pull --rebase && doom sync -u builtin cd $XDG_CONFIG_HOME/emacs
# TODO autodetect failure in emacs and rebuild it completely git pull --rebase
true | doom sync -u || { rm -rf "$DOOMLOCALDIR/straight" && doom sync -u; }
fi
else yadm l else yadm l
sudo apt update && sudo apt upgrade sudo apt update && sudo apt upgrade
fi fi