diff options
author | Matt Strapp <matt@mattstrapp.net> | 2024-11-11 12:02:24 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2024-11-11 13:41:03 -0600 |
commit | 8b41125cf167b66b9a71e43a6d55afc79d546839 (patch) | |
tree | 46a593c2aadcbe86db162825cff1c2d33f816c4d /dot_local/bin/executable_update | |
parent | Add a brew update (diff) | |
download | dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar.gz dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar.bz2 dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar.lz dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar.xz dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.tar.zst dotfiles-8b41125cf167b66b9a71e43a6d55afc79d546839.zip |
shellcheck format
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r-- | dot_local/bin/executable_update | 103 |
1 files changed, 49 insertions, 54 deletions
diff --git a/dot_local/bin/executable_update b/dot_local/bin/executable_update index 6ab440c..1c36665 100644 --- a/dot_local/bin/executable_update +++ b/dot_local/bin/executable_update @@ -11,13 +11,12 @@ fi # Get current Distro if [ -f /etc/os-release ]; then - # shellcheck source=/etc/os-release - . /etc/os-release - if [ -z "$ID_LIKE" ]; then - ID_LIKE="" - fi + . /etc/os-release + if [ -z "$ID_LIKE" ]; then + ID_LIKE="" + fi else - ID=$(uname -s) + ID=$(uname -s) fi UPDATED=0 @@ -25,51 +24,50 @@ UPDATED=0 set -- "$ID" "$ID_LIKE" for i in "$@"; do case "$i" in - # YUNO use ID_LIKE, chimera :( - alpine | chimera) - sudo apk update || return 1 - sudo apk upgrade || return 1 - UPDATED=1 - ;; - arch) - # TODO: Find a way to prefer one over the other besides hardcoding - if [ -x "$(command -v yay)" ]; then - yay -Syu || return 1 - yay -Yc || return 1 - elif [ -x "$(command -v paru)" ]; then - paru -Syu || return 1 - paru -c || return 1 - else - sudo pacman -Syu || return 1 - fi - UPDATED=1 - ;; - Darwin) - brew update || return 1 - brew upgrade -g || return 1 - brew cleanup || return 1 - UPDATED=1 - ;; - debian) - sudo apt update || return 1 - sudo apt dist-upgrade || return 1 - sudo apt autoremove || return 1 - UPDATED=1 - ;; - gentoo) - sudo emaint -a sync || return 1 - sudo emerge -avuDU --changed-use @world || return 1 - sudo emerge -av --depclean || return 1 - UPDATED=1 - ;; - opensuse) - sudo zypper refresh || return 1 - sudo zypper update || return 1 - sudo zypper clean -a || return 1 - UPDATED=1 - ;; - *) - ;; + # YUNO use ID_LIKE, chimera :( + alpine | chimera) + sudo apk update || return 1 + sudo apk upgrade || return 1 + UPDATED=1 + ;; + arch) + # TODO: Find a way to prefer one over the other besides hardcoding + if [ -x "$(command -v yay)" ]; then + yay -Syu || return 1 + yay -Yc || return 1 + elif [ -x "$(command -v paru)" ]; then + paru -Syu || return 1 + paru -c || return 1 + else + sudo pacman -Syu || return 1 + fi + UPDATED=1 + ;; + Darwin) + brew update || return 1 + brew upgrade -g || return 1 + brew cleanup || return 1 + UPDATED=1 + ;; + debian) + sudo apt update || return 1 + sudo apt dist-upgrade || return 1 + sudo apt autoremove || return 1 + UPDATED=1 + ;; + gentoo) + sudo emaint -a sync || return 1 + sudo emerge -avuDU --changed-use @world || return 1 + sudo emerge -av --depclean || return 1 + UPDATED=1 + ;; + opensuse) + sudo zypper refresh || return 1 + sudo zypper update || return 1 + sudo zypper clean -a || return 1 + UPDATED=1 + ;; + *) ;; esac if [ "$UPDATED" -eq 1 ]; then break @@ -83,7 +81,6 @@ if [ -x "$(command -v flatpak)" ]; then fi # Update snaps, if snap is installed -# flatpaks are better (this is not even a hot take) if [ -x "$(command -v snap)" ]; then sudo snap refresh || return 1 UPDATED=1 @@ -93,5 +90,3 @@ if [ "$UPDATED" -eq 0 ]; then echo "No package managers found!" exit 1 fi - - |