Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions scripts/install-openshell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,28 @@ 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 — 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
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

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]+' | head -1 || 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..."
Expand Down
Loading