From 1cb6ef1bc8cc7d0b59dcd43d51db8bdd826cb2f9 Mon Sep 17 00:00:00 2001 From: Aaron Erickson Date: Sun, 22 Mar 2026 12:42:14 -0700 Subject: [PATCH 1/3] fix: upgrade openshell when installed version is below minimum The install script previously exited immediately if openshell was already installed, regardless of version. Users on 0.0.6 would stay on 0.0.6 and hit cgroup v2 failures fixed in 0.0.7 (OpenShell#329). Now checks the installed version against a minimum (0.0.7) and upgrades automatically if too old. Closes #136 --- scripts/install-openshell.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/install-openshell.sh b/scripts/install-openshell.sh index 444987eda24..e52a5b3ac98 100644 --- a/scripts/install-openshell.sh +++ b/scripts/install-openshell.sh @@ -30,9 +30,21 @@ esac info "Detected $OS_LABEL ($ARCH_LABEL)" +# Minimum version required for cgroup v2 fix (NVIDIA/OpenShell#329) +MIN_VERSION="0.0.7" + +version_gte() { + # Returns 0 (true) if $1 >= $2 using sort -V + [ "$(printf '%s\n%s' "$1" "$2" | sort -V | head -1)" = "$2" ] +} + if command -v openshell > /dev/null 2>&1; then - info "openshell already installed: $(openshell --version 2>&1 || echo 'unknown')" - exit 0 + INSTALLED_VERSION="$(openshell --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo '0.0.0')" + if version_gte "$INSTALLED_VERSION" "$MIN_VERSION"; then + info "openshell already installed: $INSTALLED_VERSION (>= $MIN_VERSION)" + exit 0 + fi + warn "openshell $INSTALLED_VERSION is below minimum $MIN_VERSION — upgrading..." fi info "Installing openshell CLI..." From 155c5fceade37c971b43c4011cd57aacc8da0e30 Mon Sep 17 00:00:00 2001 From: Aaron Erickson Date: Sun, 22 Mar 2026 12:51:28 -0700 Subject: [PATCH 2/3] fix: use portable version comparison (no sort -V for BSD compat) --- scripts/install-openshell.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/install-openshell.sh b/scripts/install-openshell.sh index e52a5b3ac98..11b1a682e4b 100644 --- a/scripts/install-openshell.sh +++ b/scripts/install-openshell.sh @@ -34,8 +34,15 @@ info "Detected $OS_LABEL ($ARCH_LABEL)" MIN_VERSION="0.0.7" version_gte() { - # Returns 0 (true) if $1 >= $2 using sort -V - [ "$(printf '%s\n%s' "$1" "$2" | sort -V | head -1)" = "$2" ] + # Returns 0 (true) if $1 >= $2 — portable, no sort -V (BSD compat) + local IFS=. + local -a a=($1) b=($2) + for i in 0 1 2; do + local ai=${a[$i]:-0} bi=${b[$i]:-0} + if (( ai > bi )); then return 0; fi + if (( ai < bi )); then return 1; fi + done + return 0 } if command -v openshell > /dev/null 2>&1; then From 252bad9674245997b6bd8d49535b4735f92c47a8 Mon Sep 17 00:00:00 2001 From: Aaron Erickson Date: Sun, 22 Mar 2026 13:00:00 -0700 Subject: [PATCH 3/3] fix: use head -1 to extract single version from openshell output --- scripts/install-openshell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install-openshell.sh b/scripts/install-openshell.sh index 11b1a682e4b..1d54408c03a 100644 --- a/scripts/install-openshell.sh +++ b/scripts/install-openshell.sh @@ -46,7 +46,7 @@ version_gte() { } if command -v openshell > /dev/null 2>&1; then - INSTALLED_VERSION="$(openshell --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' || echo '0.0.0')" + INSTALLED_VERSION="$(openshell --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo '0.0.0')" if version_gte "$INSTALLED_VERSION" "$MIN_VERSION"; then info "openshell already installed: $INSTALLED_VERSION (>= $MIN_VERSION)" exit 0