Skip to content

Commit c91aea9

Browse files
committed
fix(install): remove OPENSHELL_INSTALL_METHOD variable
The contract of `install.sh` is to choose the best installation method for the host system. Adding the `OPENSHELL_INSTALL_METHOD` variable breaks that contract, so it is best to remove it. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
1 parent 8db6072 commit c91aea9

3 files changed

Lines changed: 19 additions & 139 deletions

File tree

docs/about/installation.mdx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ brew services restart openshell
5656

5757
On distributions that ship with `snapd`, the install script uses the Snap path
5858
described below, unless one of the following is true:
59-
- a native (non-snap) Docker package is present (the `openshell` snap requires the `docker` snap, for now)
59+
6060
- `snapd` is not present
61-
- `OPENSHELL_INSTALL_METHOD` is set in the environment to some value other than `snap` (e.g. `OPENSHELL_INSTALL_METHOD=deb`)
61+
- a native (non-snap) Docker package is present (the `openshell` snap requires the `docker` snap, until snapd 2.77 is released to the `latest/stable` channel)
6262

6363
On Fedora and RHEL, the install script uses RPM packages. The RPM installs the `openshell` CLI, the `openshell-gateway` daemon, and a systemd user service.
6464

65-
On Debian and Ubuntu, the install script uses a Debian package. The Debian package installs the `openshell` CLI, the `openshell-gateway` daemon, VM sandbox support, and a systemd user service.
65+
On Debian and Ubuntu (where the snap is not applicable), the install script uses a Debian package. The Debian package installs the `openshell` CLI, the `openshell-gateway` daemon, VM sandbox support, and a systemd user service.
6666

6767
Linux packages require glibc 2.28 or newer. The installer checks libc before downloading packages and exits with an error on older glibc versions, Alpine, musl-based distributions, or unknown libc environments.
6868

@@ -188,26 +188,6 @@ Use the `openshell` `.deb` or `.rpm` file when `snapd` is unavailable or when
188188
you already run Docker from a non-snap source. The installer falls back to
189189
these methods on hosts with native Docker.
190190

191-
### Force an install method
192-
193-
Set `OPENSHELL_INSTALL_METHOD` to force a specific install method instead of
194-
relying on auto-detection. Supported values:
195-
196-
| Value | Install path |
197-
|---|---|
198-
| `deb` | Debian package via `apt`/`dpkg` |
199-
| `rpm` | RPM package via `dnf`/`yum`/`zypper`/`rpm` |
200-
| `snap` | Snap package via `snapd` |
201-
| `homebrew` | Homebrew formula via `brew` (macOS only; not yet supported on Linux) |
202-
203-
When the variable is unset, the script auto-detects the host package manager
204-
as described above. If the requested method's package manager is not
205-
installed, the installer aborts with an error.
206-
207-
```shell
208-
curl -LsSf https://raw.githubusercontent.com/NVIDIA/OpenShell/main/install.sh | OPENSHELL_INSTALL_METHOD=deb sh
209-
```
210-
211191
## Kubernetes
212192

213193
Kubernetes deployments use the OpenShell Helm chart. For step-by-step installation, refer to [Kubernetes Setup](/kubernetes/setup). For chart values and packaging details, refer to the [Helm chart README](https://github.com/NVIDIA/OpenShell/blob/main/deploy/helm/openshell/README.md).

install.sh

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ OPTIONS:
5151
ENVIRONMENT VARIABLES:
5252
OPENSHELL_VERSION Release tag to install (default: latest tagged release).
5353
Set OPENSHELL_VERSION=dev to install the rolling dev build.
54-
OPENSHELL_INSTALL_METHOD
55-
Force a specific install method. Supported values:
56-
deb, rpm, snap, homebrew. When unset, the script
57-
auto-detects the host package manager.
5854
OPENSHELL_ACK_BREAKING_UPGRADE
5955
Set to 1 only after backing up and cleaning up a
6056
pre-v0.0.37 installation.
@@ -481,38 +477,14 @@ detect_platform() {
481477
}
482478

483479
linux_package_method() {
484-
case "${OPENSHELL_INSTALL_METHOD:-}" in
485-
"")
486-
;;
487-
snap)
488-
echo "snap"
489-
return 0
490-
;;
491-
deb|apt)
492-
echo "deb"
493-
return 0
494-
;;
495-
rpm|dnf|yum|zypper)
496-
echo "rpm"
497-
return 0
498-
;;
499-
homebrew|brew)
500-
echo "homebrew"
501-
return 0
502-
;;
503-
*)
504-
error "OPENSHELL_INSTALL_METHOD='${OPENSHELL_INSTALL_METHOD}' is not supported; use one of: deb, rpm, snap, homebrew"
505-
;;
506-
esac
507-
508480
if has_snapd && ! has_native_docker; then
509481
echo "snap"
510482
elif has_cmd dpkg; then
511483
echo "deb"
512484
elif has_cmd rpm; then
513485
echo "rpm"
514486
else
515-
error "Linux installs require either dpkg or rpm"
487+
error "Linux installs require either snapd, dpkg, or rpm"
516488
fi
517489
}
518490

@@ -1153,24 +1125,12 @@ main() {
11531125
require_linux_package_glibc
11541126
install_linux_rpm
11551127
;;
1156-
homebrew)
1157-
# TODO: implement install_linux_homebrew for Linuxbrew hosts
1158-
# (e.g. Universal Blue/Bazzite). Homebrew is accepted as a method
1159-
# value but not yet wired to an installer on Linux.
1160-
error "the 'homebrew' install method is not yet supported on Linux"
1161-
;;
11621128
*)
11631129
error "unsupported Linux package method"
11641130
;;
11651131
esac
11661132
;;
11671133
darwin)
1168-
case "${OPENSHELL_INSTALL_METHOD:-}" in
1169-
""|homebrew|brew) ;;
1170-
*)
1171-
error "only the 'homebrew' install method is supported on macOS"
1172-
;;
1173-
esac
11741134
install_macos_homebrew
11751135
;;
11761136
*)

tasks/scripts/test-install-sh.sh

Lines changed: 15 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -100,68 +100,10 @@ assert_glibc_preflight_fails \
100100
"OpenShell Linux packages require glibc >= 2.28; detected musl or unsupported libc." \
101101
setup_ldd_musl
102102

103-
assert_method_equals() {
104-
local name=$1
105-
local value=$2
106-
local expected=$3
107-
108-
local result
109-
if ! result="$(OPENSHELL_INSTALL_METHOD="$value" linux_package_method)" 2>"$err"; then
110-
echo "FAIL: ${name}: expected '${expected}' but call failed" >&2
111-
cat "$err" >&2 || true
112-
exit 1
113-
fi
114-
115-
if [ "$result" != "$expected" ]; then
116-
echo "FAIL: ${name}: expected '${expected}', got '${result}'" >&2
117-
exit 1
118-
fi
119-
}
120-
121-
assert_method_fails() {
122-
local name=$1
123-
local value=$2
124-
local expected=$3
125-
126-
if (OPENSHELL_INSTALL_METHOD="$value" linux_package_method) >"$out" 2>"$err"; then
127-
echo "FAIL: ${name}: expected failure for value '${value}'" >&2
128-
exit 1
129-
fi
130-
131-
if ! grep -Fq "$expected" "$err"; then
132-
echo "FAIL: ${name}: missing expected message" >&2
133-
echo "Expected: ${expected}" >&2
134-
echo "Actual:" >&2
135-
cat "$err" >&2 || true
136-
exit 1
137-
fi
138-
}
139-
140-
assert_method_equals "method deb passes through" "deb" "deb"
141-
assert_method_equals "method rpm passes through" "rpm" "rpm"
142-
assert_method_equals "method snap passes through" "snap" "snap"
143-
assert_method_equals "method homebrew passes through" "homebrew" "homebrew"
144-
145-
assert_method_equals "alias apt maps to deb" "apt" "deb"
146-
assert_method_equals "alias dnf maps to rpm" "dnf" "rpm"
147-
assert_method_equals "alias yum maps to rpm" "yum" "rpm"
148-
assert_method_equals "alias zypper maps to rpm" "zypper" "rpm"
149-
assert_method_equals "alias brew maps to homebrew" "brew" "homebrew"
150-
151-
assert_method_fails \
152-
"unknown method fails" \
153-
"apk" \
154-
"is not supported; use one of: deb, rpm, snap, homebrew"
155-
156-
assert_method_fails \
157-
"classic method fails" \
158-
"classic" \
159-
"is not supported; use one of: deb, rpm, snap, homebrew"
160-
161-
# Unset OPENSHELL_INSTALL_METHOD falls through to host detection. Shim the
162-
# has_* helpers so the auto-detect path is deterministic regardless of the
163-
# host running the tests.
164-
assert_method_unset_detects() {
103+
# Package format is detected based on the host environment. Shim the has_*
104+
# helpers so the auto-detect path is deterministic regardless of the host
105+
# running the tests.
106+
assert_package_format_detection() {
165107
local name=$1
166108
local snapd=$2
167109
local native_docker=$3
@@ -171,7 +113,6 @@ assert_method_unset_detects() {
171113

172114
local result
173115
if ! result="$(
174-
unset OPENSHELL_INSTALL_METHOD
175116
has_snapd() { [ "$snapd" = "1" ]; }
176117
has_native_docker() { [ "$native_docker" = "1" ]; }
177118
has_cmd() {
@@ -194,35 +135,34 @@ assert_method_unset_detects() {
194135
fi
195136
}
196137

197-
assert_method_unset_detects \
198-
"unset prefers snap when snapd and no native docker" \
138+
assert_package_format_detection \
139+
"prefers snap when snapd and no native docker" \
199140
1 0 1 1 "snap"
200141

201-
assert_method_unset_detects \
202-
"unset skips snap when native docker present" \
142+
assert_package_format_detection \
143+
"skips snap when native docker present" \
203144
1 1 1 0 "deb"
204145

205-
assert_method_unset_detects \
206-
"unset skips snap when snapd absent" \
146+
assert_package_format_detection \
147+
"skips snap when snapd absent" \
207148
0 0 1 0 "deb"
208149

209-
assert_method_unset_detects \
210-
"unset falls back to rpm when no dpkg" \
150+
assert_package_format_detection \
151+
"falls back to rpm when no dpkg" \
211152
0 0 0 1 "rpm"
212153

213-
# Unset with no snapd, no dpkg, no rpm must error.
154+
# Host with no snapd, no dpkg, no rpm must error.
214155
if (
215-
unset OPENSHELL_INSTALL_METHOD
216156
has_snapd() { return 1; }
217157
has_native_docker() { return 1; }
218158
has_cmd() { return 1; }
219159
linux_package_method
220160
) >"$out" 2>"$err"; then
221-
echo "FAIL: unset with no package managers should error" >&2
161+
echo "FAIL: host with no package managers should error" >&2
222162
exit 1
223163
fi
224164

225-
if ! grep -Fq "Linux installs require either dpkg or rpm" "$err"; then
165+
if ! grep -Fq "Linux installs require either snapd, dpkg, or rpm" "$err"; then
226166
echo "FAIL: missing no-package-manager error" >&2
227167
cat "$err" >&2 || true
228168
exit 1

0 commit comments

Comments
 (0)