From 88240f9731d8ce4060a9b19f223011fd9e448019 Mon Sep 17 00:00:00 2001 From: Tony Blyler Date: Thu, 28 Sep 2023 10:10:41 -0400 Subject: [PATCH] Fix upgrade_system for asdf plugins --- chezmoi/dot_tool-versions | 5 ++-- .../dot_zshrc.d/executable_upgrade_system.sh | 29 ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/chezmoi/dot_tool-versions b/chezmoi/dot_tool-versions index 932d408..f1500ca 100644 --- a/chezmoi/dot_tool-versions +++ b/chezmoi/dot_tool-versions @@ -1,3 +1,4 @@ golang 1.21.1 -chezmoi 2.39.1 -nodejs 18.17.1 +chezmoi 2.40.0 +nodejs 18.18.0 +python 3.11.5 diff --git a/chezmoi/dot_zshrc.d/executable_upgrade_system.sh b/chezmoi/dot_zshrc.d/executable_upgrade_system.sh index 17d7f69..2d81553 100644 --- a/chezmoi/dot_zshrc.d/executable_upgrade_system.sh +++ b/chezmoi/dot_zshrc.d/executable_upgrade_system.sh @@ -38,10 +38,31 @@ upgrade_system() { esac if command -v asdf &> /dev/null; then - asdf update || true - asdf plugin update --all - asdf latest --all - asdf nodejs resolve lts --latest-avaliable + ( + cd "$HOME" + asdf update || true + asdf plugin update --all + asdf latest --all | grep -Ev '^(python|nodejs)' + LATEST_PYTHON_VERSION="$(asdf latest python)" + CURRENT_PYTHON_VERSION="$(asdf current python | awk '{print $2}')" + echo -en "python\t${LATEST_PYTHON_VERSION}\t" + if [[ "$LATEST_PYTHON_VERSION" == "$CURRENT_PYTHON_VERSION" ]]; then + echo "installed" + else + echo "missing" + fi + asdf list all nodejs | + awk -v lts="$(asdf nodejs resolve lts)" \ + -v current="$(asdf current nodejs | awk '{print $2}')" \ + 'index($0, lts) == 1 {latest=$0} END { + printf "nodejs\t"latest"\t" + if(latest == current) { + print "installed" + } else { + print "missing" + } + }' + ) fi if command -v fwupdmgr &> /dev/null; then