| 1 | |
| 2 | _dotzsh_cache="${XDG_CACHE_HOME:-$HOME/.cache}/dotzsh" |
| 3 | if [[ -s "$_dotzsh_cache/system_updates" ]]; then |
| 4 | printf "\e[33mSystem updates available. Run uds to update.\e[0m\n" |
| 5 | fi |
| 6 | if [[ -f "$_dotzsh_cache/dotzsh_update" ]]; then |
| 7 | printf "\e[34mdotzsh update available. Run udz to apply.\e[0m\n" |
| 8 | fi |
| 9 | unset _dotzsh_cache |
| 10 | |
| 11 | |
| 12 | uds() { |
| 13 | if command -v paru &>/dev/null; then |
| 14 | paru -Syu |
| 15 | elif command -v pacman &>/dev/null; then |
| 16 | sudo pacman -Syu |
| 17 | elif command -v apt &>/dev/null; then |
| 18 | sudo apt update && sudo apt upgrade |
| 19 | elif command -v dnf &>/dev/null; then |
| 20 | sudo dnf upgrade |
| 21 | fi |
| 22 | rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dotzsh/system_updates" |
| 23 | } |
| 24 | |
| 25 | |
| 26 | udz() { |
| 27 | printf "\e[34mUpdating dotzsh\e[0m\n" |
| 28 | (cd "$ZDOTDIR" && git pull --rebase) |
| 29 | rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dotzsh/dotzsh_update" |
| 30 | } |