Skip to content

Commit 5d67db1

Browse files
authored
Merge pull request #4 from openbootdotdev/claude/fix-install-script-version-i5xDr
Switch OpenBoot installation from Homebrew tap to GitHub releases
2 parents 3fc9551 + 316b888 commit 5d67db1

2 files changed

Lines changed: 40 additions & 31 deletions

File tree

src/lib/server/install-script.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('generateInstallScript', () => {
136136
expect(script).toContain('#!/bin/bash');
137137
expect(script).toContain('OpenBoot Installer');
138138
expect(script).toContain('Config: @testuser/my-config');
139-
expect(script).toContain('brew install ${TAP_NAME}/openboot');
139+
expect(script).toContain('api.github.com/repos/${OPENBOOT_REPO}/releases/latest');
140140
expect(script).toContain('--user "testuser/my-config"');
141141
});
142142

@@ -182,13 +182,13 @@ describe('generateInstallScript', () => {
182182
expect(script).not.toContain('my config!');
183183
});
184184

185-
it('should install openboot via Homebrew tap', () => {
185+
it('should install openboot via GitHub releases', () => {
186186
const script = generateInstallScript('testuser', 'my-config');
187187

188-
expect(script).toContain('TAP_NAME="openbootdotdev/tap"');
189-
expect(script).toContain('brew install ${TAP_NAME}/openboot');
190-
expect(script).toContain('brew list openboot');
191-
expect(script).toContain('Reinstall? (y/N)');
188+
expect(script).toContain('OPENBOOT_REPO="openbootdotdev/openboot"');
189+
expect(script).toContain('api.github.com/repos/${OPENBOOT_REPO}/releases/latest');
190+
expect(script).toContain('install_openboot()');
191+
expect(script).toContain('github.com/${OPENBOOT_REPO}/releases/download/${latest_version}/openboot-');
192192
});
193193

194194
it('should pass through additional arguments to openboot', () => {

src/lib/server/install-script.ts

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function generateInstallScript(
105105
return `#!/bin/bash
106106
set -euo pipefail
107107
108-
TAP_NAME="openbootdotdev/tap"
108+
OPENBOOT_REPO="openbootdotdev/openboot"
109109
110110
main() {
111111
# When run via "curl | bash", stdin is the script content, not the terminal.
@@ -205,39 +205,48 @@ install_homebrew() {
205205
echo ""
206206
}
207207
208-
local os arch
209-
os=\$(detect_os)
210-
arch=\$(detect_arch)
208+
install_openboot() {
209+
local os_name="\$1"
210+
local arch_name="\$2"
211211
212-
echo "Detected: \${os}/\${arch}"
213-
echo ""
212+
echo "Fetching latest OpenBoot version..."
213+
local latest_version
214+
latest_version=\$(curl -fsSL "https://api.github.com/repos/\${OPENBOOT_REPO}/releases/latest" \\
215+
| grep '"tag_name"' | grep -o 'v[0-9][0-9.]*')
214216
215-
install_xcode_clt
216-
install_homebrew
217+
if [[ -z "\$latest_version" ]]; then
218+
echo "Error: Could not fetch latest OpenBoot version" >&2
219+
exit 1
220+
fi
221+
222+
local binary_url="https://github.com/\${OPENBOOT_REPO}/releases/download/\${latest_version}/openboot-\${os_name}-\${arch_name}"
217223
218-
if brew list openboot &>/dev/null 2>&1; then
219-
echo "OpenBoot is already installed via Homebrew."
224+
echo "Installing OpenBoot \${latest_version}..."
220225
echo ""
221-
read -p "Reinstall? (y/N) " -n 1 -r
222-
echo
223-
224-
if [[ \$REPLY =~ ^[Yy]\$ ]]; then
225-
echo "Reinstalling OpenBoot..."
226-
brew reinstall \${TAP_NAME}/openboot
227-
echo ""
228-
echo "OpenBoot reinstalled!"
226+
227+
curl -fsSL "\$binary_url" -o /tmp/openboot-install
228+
chmod +x /tmp/openboot-install
229+
230+
if [[ -w "/usr/local/bin" ]]; then
231+
mv /tmp/openboot-install /usr/local/bin/openboot
229232
else
230-
echo "Using existing installation."
233+
sudo mv /tmp/openboot-install /usr/local/bin/openboot
231234
fi
232-
else
233-
echo "Installing OpenBoot via Homebrew..."
235+
234236
echo ""
237+
echo "OpenBoot \${latest_version} installed!"
238+
}
235239
236-
brew install \${TAP_NAME}/openboot
240+
local os arch
241+
os=\$(detect_os)
242+
arch=\$(detect_arch)
237243
238-
echo ""
239-
echo "OpenBoot installed!"
240-
fi
244+
echo "Detected: \${os}/\${arch}"
245+
echo ""
246+
247+
install_xcode_clt
248+
install_homebrew
249+
install_openboot "\$os" "\$arch"
241250
242251
echo ""
243252
echo "Starting OpenBoot setup with config: @${safeUsername}/${safeSlug}"

0 commit comments

Comments
 (0)