Fix upgrade_system for asdf plugins

This commit is contained in:
Tony Blyler 2023-09-29 12:16:58 -04:00
parent 88240f9731
commit d04e87da0a

View file

@ -38,31 +38,38 @@ upgrade_system() {
esac esac
if command -v asdf &> /dev/null; then if command -v asdf &> /dev/null; then
( asdf update || true
cd "$HOME" asdf plugin update --all
asdf update || true echo -e 'package\tversion\tlatest\tstatus'
asdf plugin update --all awk '{
asdf latest --all | grep -Ev '^(python|nodejs)' package = $1
LATEST_PYTHON_VERSION="$(asdf latest python)" if(package == "nodejs") {
CURRENT_PYTHON_VERSION="$(asdf current python | awk '{print $2}')" next
echo -en "python\t${LATEST_PYTHON_VERSION}\t" }
if [[ "$LATEST_PYTHON_VERSION" == "$CURRENT_PYTHON_VERSION" ]]; then
echo "installed" installed_version = $2
else "asdf latest " package | getline
echo "missing" latest_version = $0
fi printf package"\t"installed_version"\t"latest_version"\t"
if(installed_version == latest_version) {
print "up-to-date"
} else {
print "out-of-date"
}
}' "${HOME}/.tool-versions"
if grep -q '^nodejs' "${HOME}/.tool-versions"; then
asdf list all nodejs | asdf list all nodejs |
awk -v lts="$(asdf nodejs resolve lts)" \ awk -v lts="$(asdf nodejs resolve lts)" \
-v current="$(asdf current nodejs | awk '{print $2}')" \ -v current="$(asdf current nodejs | awk '{print $2}')" \
'index($0, lts) == 1 {latest=$0} END { 'index($0, lts) == 1 {latest=$0} END {
printf "nodejs\t"latest"\t" printf "nodejs\t"current"\t"latest"\t"
if(latest == current) { if(latest == current) {
print "installed" print "up-to-date"
} else { } else {
print "missing" print "out-of-date"
} }
}' }'
) fi
fi fi
if command -v fwupdmgr &> /dev/null; then if command -v fwupdmgr &> /dev/null; then