-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·105 lines (83 loc) · 2.8 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·105 lines (83 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env bash
set -e
REPO="forjd/browse"
BIN_DIR="$HOME/.local/bin"
echo "Installing browse..."
echo ""
# Check prerequisites
if ! command -v bun &>/dev/null; then
echo "Error: bun is not installed. Install it with: curl -fsSL https://bun.sh/install | bash"
exit 1
fi
BUN_VERSION=$(bun --version)
BUN_MAJOR=$(echo "$BUN_VERSION" | cut -d. -f1)
if [ "$BUN_MAJOR" -lt 1 ]; then
echo "Error: bun >= 1.0 required, found $BUN_VERSION"
exit 1
fi
echo " bun $BUN_VERSION"
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH_LABEL="x86_64" ;;
aarch64) ARCH_LABEL="arm64" ;;
arm64) ARCH_LABEL="arm64" ;;
*)
echo "Error: unsupported architecture: $ARCH"
exit 1
;;
esac
ARTIFACT="browse-${OS}-${ARCH_LABEL}"
echo " platform: ${OS}-${ARCH_LABEL}"
# Fetch latest release tag
TAG=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
| grep '"tag_name"' | head -1 | cut -d'"' -f4)
if [ -z "$TAG" ]; then
echo "Error: could not determine latest release. Check https://github.com/${REPO}/releases"
exit 1
fi
echo " release: $TAG"
# Download binary
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}"
mkdir -p "$BIN_DIR"
echo ""
echo "Downloading ${ARTIFACT}..."
if ! curl -fSL --progress-bar -o "${BIN_DIR}/browse" "$DOWNLOAD_URL"; then
echo ""
echo "Error: failed to download binary."
echo "Available binaries for ${TAG}: https://github.com/${REPO}/releases/tag/${TAG}"
exit 1
fi
chmod +x "${BIN_DIR}/browse"
# Re-sign on macOS — downloaded binaries may have invalid signatures
if [ "$(uname -s)" = "Darwin" ]; then
codesign -s - -f "${BIN_DIR}/browse" 2>/dev/null || true
xattr -d com.apple.quarantine "${BIN_DIR}/browse" 2>/dev/null || true
fi
echo " binary: ${BIN_DIR}/browse"
# Install Chrome for Testing (matches setup.sh and CI). The release binary
# embeds patchright, so browsers must be installed via patchright — upstream
# playwright fetches different browser revisions the binary won't find.
echo ""
echo "Installing Chrome..."
bunx patchright install chrome
echo " Chrome installed"
# Optional: install additional browsers via BROWSE_BROWSERS env var
# e.g. BROWSE_BROWSERS="firefox webkit" bash install.sh
if [ -n "$BROWSE_BROWSERS" ]; then
for EXTRA_BROWSER in $BROWSE_BROWSERS; do
echo " Installing $EXTRA_BROWSER..."
bunx patchright install "$EXTRA_BROWSER"
echo " $EXTRA_BROWSER installed"
done
fi
# Check PATH
if ! echo "$PATH" | tr ':' '\n' | grep -q "$BIN_DIR"; then
echo ""
echo "Note: ~/.local/bin is not on your PATH. Add it with:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo "Add this to your shell profile (~/.zshrc or ~/.bashrc) to make it permanent."
fi
echo ""
echo "Done. Run 'browse goto https://example.com' to get started."