Commit 400500e
committed
fix(install): unbreak macOS, atomic Linux install, real version smoke test
The current install script has three issues that affect every user:
1. macOS install produces a binary the kernel kills at exec
The nightly Mach-O assets from GitHub Releases (lightpanda-aarch64-macos,
lightpanda-x86_64-macos) get SIGKILLed at exec on Apple Silicon despite
shipping with an ad-hoc / linker signature. Ad-hoc re-signing locally
does not help. Reproduces 100% of the time on M-series Macs running the
release asset directly. The existing brew tap at
lightpanda-io/browser/lightpanda builds from source and produces a binary
that runs, so route Darwin through it.
2. Linux install destroys an existing working binary on any failed rerun
SKILL.md documents reruns of this script as the update path:
> If you encounter crashes or issues, run scripts/install.sh again to
> update to the latest version (max once per day).
But `curl -L -o "$INSTALL_DIR/$BINARY_NAME"` overwrites the install
target during download. A failed download (network drop, checksum
mismatch, unrunnable replacement) leaves the user with no binary or a
broken one even though they had a working one before. Atomic install via
mktemp -> verify -> smoke-test -> mv preserves the existing binary on
any failure.
3. Smoke test silently accepts broken binaries
The test currently is:
"$INSTALL_DIR/$BINARY_NAME" --version 2>/dev/null || \
"$INSTALL_DIR/$BINARY_NAME" --help 2>/dev/null | head -1
Lightpanda's CLI does not have a --version flag. Running it logs
'$msg=exit err=UnknownCommand' to stderr and exits 1. The 2>/dev/null
masks this and the script falls through to the --help branch. On a
binary that crashes at exec (the macOS case above), --help also fails,
but the surrounding 'if ... | head -1; then' construction still ends in
the success branch on macOS because head exits 0 on empty stdin.
Result: 'Lightpanda installed successfully!' for an unrunnable binary.
Use the 'version' subcommand (which is the actual Lightpanda CLI form),
capture stderr to a tempfile, and fail hard with the binary's stderr
surfaced so users see real diagnostics like 'GLIBC_2.32 not found' on
incompatible systems.
## Other changes in this PR
- `set -euo pipefail` (was `set -e`). `pipefail` propagates a failing
curl through `curl | jq` (jq exits 0 on empty input, otherwise hiding
network errors behind a misleading 'could not retrieve checksum').
- `chmod 0755` instead of `chmod a+x`. mktemp creates 0600; `a+x` on
top of that is 0711 (owner-only readable), which is surprising on a
shared install path.
- Optional $GITHUB_TOKEN raises the GitHub API quota from 60->5000/hr.
Branched curl call rather than building a header array — Bash <=4.3
(RHEL 7, old containers) errors on empty-array expansion under `set -u`.
- PATH-shadow check on both macOS and Linux. Warns when another
`lightpanda` is earlier in PATH than the freshly installed one
(catches stale binaries from earlier install attempts).
- SKILL.md install section gains a per-OS strategy callout describing
the new flow.
## Verified
End-to-end run on Apple Silicon (after first reverting the broken release
binary): brew install/upgrade succeeds, version subcommand prints
'1.0.0-nightly.6051+d360fcc0', PATH check passes.1 parent bc562f3 commit 400500e
2 files changed
Lines changed: 131 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
4 | 17 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 18 | | |
9 | 19 | | |
10 | 20 | | |
11 | | - | |
12 | 21 | | |
13 | | - | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
| |||
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
45 | 94 | | |
46 | 95 | | |
47 | 96 | | |
| |||
50 | 99 | | |
51 | 100 | | |
52 | 101 | | |
| 102 | + | |
| 103 | + | |
53 | 104 | | |
| 105 | + | |
54 | 106 | | |
55 | 107 | | |
56 | | - | |
57 | 108 | | |
58 | 109 | | |
59 | 110 | | |
| |||
69 | 120 | | |
70 | 121 | | |
71 | 122 | | |
72 | | - | |
73 | 123 | | |
74 | 124 | | |
75 | | - | |
76 | 125 | | |
77 | 126 | | |
78 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
79 | 132 | | |
80 | | - | |
81 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
82 | 140 | | |
83 | 141 | | |
84 | 142 | | |
85 | 143 | | |
86 | 144 | | |
87 | 145 | | |
88 | | - | |
89 | 146 | | |
90 | 147 | | |
91 | 148 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
95 | 158 | | |
96 | | - | |
97 | 159 | | |
98 | 160 | | |
99 | | - | |
| 161 | + | |
100 | 162 | | |
101 | | - | |
| 163 | + | |
102 | 164 | | |
103 | 165 | | |
104 | 166 | | |
105 | 167 | | |
106 | 168 | | |
107 | 169 | | |
108 | | - | |
| 170 | + | |
109 | 171 | | |
110 | 172 | | |
111 | 173 | | |
112 | 174 | | |
113 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
114 | 199 | | |
115 | | - | |
| 200 | + | |
116 | 201 | | |
117 | 202 | | |
118 | 203 | | |
119 | 204 | | |
120 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
121 | 214 | | |
122 | 215 | | |
123 | | - | |
124 | 216 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 217 | + | |
131 | 218 | | |
132 | 219 | | |
133 | 220 | | |
| |||
0 commit comments