Skip to content

Commit 703f7c0

Browse files
chapterjasonclaude
andcommitted
Drop web-shell startup apt retry and sudo -E npm install bug
The dtach/build-essential/python3 prereqs are now baked into the devcontainer base image (Dockerfile.devcontainer-base), so the dpkg guard, retry loop, and dtach verification all become dead code. The npm install also dropped sudo -E. With it, root inherited HOME from the caller and wrote root-owned $HOME/.npm and $HOME/.cache/node-gyp into the user's home, breaking every later `npm install` the user ran. The nvm feature already chowns the global prefix to the user, so plain `npm install -g` works. Also removes the now-stale src/web-shell feature test, which only checked the prereq install paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 45ca1e3 commit 703f7c0

2 files changed

Lines changed: 1 addition & 55 deletions

File tree

terraform/web-shell/run.sh

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,6 @@ if [ -z "$${WANTED_VERSION}" ]; then
2323
exit 1
2424
fi
2525

26-
# Install prereqs: dtach is required at runtime; build-essential + python3 cover
27-
# node-pty's native build step when a prebuilt binding isn't available.
28-
need=()
29-
for pkg in dtach build-essential python3; do
30-
dpkg -s "$pkg" >/dev/null 2>&1 || need+=("$pkg")
31-
done
32-
if [ $${#need[@]} -gt 0 ]; then
33-
printf "$${BOLD}Installing prereqs: $${need[*]}$${RESET}\n"
34-
# Retry on transient apt failures: dpkg-lock contention when other startup
35-
# scripts run apt in parallel, network flakes on apt-get update, mirror
36-
# hiccups. Exit codes were previously unchecked, so failures silently left
37-
# dtach missing and web-shell broke on first session.
38-
installed=0
39-
for attempt in 1 2 3; do
40-
if sudo apt-get update && \
41-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$${need[@]}"; then
42-
installed=1
43-
break
44-
fi
45-
echo "apt-get attempt $${attempt} failed; retrying..." >&2
46-
sleep $$((attempt * 2))
47-
done
48-
if [ "$${installed}" -ne 1 ]; then
49-
echo "Failed to install prereqs after 3 attempts: $${need[*]}" >&2
50-
exit 1
51-
fi
52-
fi
53-
54-
# dtach is load-bearing — web-shell's session survival across disconnects
55-
# depends on it. Fail loud rather than starting web-shell without it.
56-
if ! command -v dtach >/dev/null 2>&1; then
57-
echo "dtach missing after install step; aborting." >&2
58-
exit 1
59-
fi
60-
6126
# Install or upgrade web-shell if the installed version doesn't match.
6227
INSTALLED_VERSION=""
6328
if command -v web-shell >/dev/null 2>&1; then
@@ -68,7 +33,7 @@ fi
6833
if [ "$${INSTALLED_VERSION}" != "$${WANTED_VERSION}" ]; then
6934
printf "$${BOLD}Installing web-shell $${WANTED_VERSION}$${RESET}\n"
7035
TARBALL="https://github.com/SoureCode/web-shell/releases/download/v$${WANTED_VERSION}/web-shell-$${WANTED_VERSION}.tgz"
71-
if ! sudo -E env "PATH=$PATH" npm install -g "$${TARBALL}"; then
36+
if ! npm install -g "$${TARBALL}"; then
7237
echo "Failed to install web-shell $${WANTED_VERSION}"
7338
exit 1
7439
fi

test/web-shell/test.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)