Skip to content

Commit d702ced

Browse files
committed
feat: add cross-platform install scripts with auto-detection (Closes #68)
1 parent 52686db commit d702ced

3 files changed

Lines changed: 309 additions & 62 deletions

File tree

INSTALLATION.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,22 @@ Get the installer for your OS from the [Releases](https://github.com/botswin/Bot
1010

1111
### 2. Windows Installation
1212

13-
#### Standard Installation
13+
#### Quick Install (PowerShell)
14+
15+
```powershell
16+
# Install latest version
17+
iwr -Uri "https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.ps1" -OutFile "$env:TEMP\install_botbrowser.ps1"; & "$env:TEMP\install_botbrowser.ps1"
18+
19+
# Install specific Chrome version
20+
iwr -Uri "https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.ps1" -OutFile "$env:TEMP\install_botbrowser.ps1"; & "$env:TEMP\install_botbrowser.ps1" -Version 145
21+
22+
# Install to custom directory
23+
iwr -Uri "https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.ps1" -OutFile "$env:TEMP\install_botbrowser.ps1"; & "$env:TEMP\install_botbrowser.ps1" -InstallDir "D:\BotBrowser"
24+
```
25+
26+
> **Note:** Requires [7-Zip](https://www.7-zip.org/) for extraction.
27+
28+
#### Manual Installation
1429
1. Extract the downloaded `.7z` archive
1530
2. Run `chrome.exe` from the extracted folder
1631

@@ -39,28 +54,19 @@ chrome.exe --bot-profile="C:\absolute\path\to\profile.enc" --user-data-dir="%TEM
3954
### 3. macOS Installation
4055

4156
#### Quick Install (Script)
42-
For the fastest setup, use our installation script:
4357

4458
```bash
45-
# One-line install (downloads and runs script directly)
46-
curl -L https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash
47-
```
59+
# Install latest version
60+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash
4861

49-
Or download and run locally:
50-
```bash
51-
# Clone repository and run script
52-
git clone https://github.com/botswin/BotBrowser.git
53-
cd BotBrowser
54-
./scripts/install_botbrowser.sh
62+
# Install specific Chrome version
63+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash -s -- 145
64+
65+
# Download only, don't install
66+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash -s -- --download
5567
```
5668

57-
The script will:
58-
- Auto-detect your Mac's architecture (Apple Silicon or Intel)
59-
- Fetch the latest release from GitHub automatically
60-
- Download the correct DMG for your platform
61-
- Mount and copy the application to `/Applications/`
62-
- Remove macOS quarantine attributes
63-
- Clean up temporary files
69+
The script auto-detects your Mac's architecture (Apple Silicon or Intel), fetches the latest release via the GitHub API, and installs to `/Applications/`.
6470

6571
#### Manual Installation
6672
1. Open the downloaded `.dmg` file
@@ -93,7 +99,28 @@ The script will:
9399

94100
> **Note:** Ubuntu/Linux binaries require an ENT Plan Tier 1 or higher subscription.
95101
96-
#### Standard Installation
102+
#### Quick Install (Script)
103+
104+
```bash
105+
# One-line install (auto-detects architecture: x86_64 or arm64)
106+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash
107+
108+
# Install specific Chrome version
109+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash -s -- 145
110+
111+
# Download only, don't install
112+
curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash -s -- --download
113+
```
114+
115+
#### Docker / CI
116+
117+
```dockerfile
118+
RUN curl -sL https://raw.githubusercontent.com/botswin/BotBrowser/main/scripts/install_botbrowser.sh | bash
119+
```
120+
121+
No hardcoded URLs needed. The script uses the GitHub Releases API to always fetch the latest build for your platform.
122+
123+
#### Manual Installation
97124
1. Install via `dpkg`:
98125
```bash
99126
sudo dpkg -i botbrowser_<version>_amd64.deb

scripts/install_botbrowser.ps1

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# BotBrowser Installer for Windows
2+
# Automatically downloads and extracts the latest release.
3+
#
4+
# Usage:
5+
# .\install_botbrowser.ps1 # Install latest
6+
# .\install_botbrowser.ps1 -Version 145 # Install latest Chrome 145 build
7+
# .\install_botbrowser.ps1 -InstallDir "D:\BB" # Custom directory
8+
9+
param(
10+
[string]$Version = "",
11+
[string]$InstallDir = "$env:LOCALAPPDATA\BotBrowser",
12+
[switch]$Help
13+
)
14+
15+
if ($Help) {
16+
Write-Host "BotBrowser Installer for Windows"
17+
Write-Host ""
18+
Write-Host "Usage:"
19+
Write-Host " .\install_botbrowser.ps1 # Install latest"
20+
Write-Host " .\install_botbrowser.ps1 -Version 145 # Chrome 145"
21+
Write-Host " .\install_botbrowser.ps1 -InstallDir 'D:\BB' # Custom directory"
22+
exit 0
23+
}
24+
25+
$ErrorActionPreference = "Stop"
26+
$Repo = "botswin/BotBrowser"
27+
$ApiBase = "https://api.github.com/repos/$Repo/releases"
28+
$AssetPattern = "_win_x86_64.7z"
29+
30+
Write-Host "Platform: Windows x86_64"
31+
32+
# Fetch release
33+
$downloadUrl = $null
34+
35+
if ($Version) {
36+
Write-Host "1. Finding latest Chrome $Version release..."
37+
$releases = Invoke-RestMethod -Uri "$ApiBase`?per_page=100" -UseBasicParsing
38+
39+
$candidates = @()
40+
foreach ($release in $releases) {
41+
if ($release.tag_name -match "^$Version\.") {
42+
foreach ($asset in $release.assets) {
43+
if ($asset.name -like "*$AssetPattern") {
44+
$candidates += $asset
45+
}
46+
}
47+
}
48+
}
49+
# Sort by name descending to get the latest date (YYYYMMDD in filename)
50+
if ($candidates.Count -gt 0) {
51+
$latest = $candidates | Sort-Object -Property name -Descending | Select-Object -First 1
52+
$downloadUrl = $latest.browser_download_url
53+
}
54+
} else {
55+
Write-Host "1. Fetching latest release info..."
56+
$release = Invoke-RestMethod -Uri "$ApiBase/latest" -UseBasicParsing
57+
58+
$candidates = @()
59+
foreach ($asset in $release.assets) {
60+
if ($asset.name -like "*$AssetPattern") {
61+
$candidates += $asset
62+
}
63+
}
64+
# Sort by name descending to get the latest date (YYYYMMDD in filename)
65+
if ($candidates.Count -gt 0) {
66+
$latest = $candidates | Sort-Object -Property name -Descending | Select-Object -First 1
67+
$downloadUrl = $latest.browser_download_url
68+
}
69+
}
70+
71+
if (-not $downloadUrl) {
72+
Write-Host "Error: Could not find download URL for $AssetPattern"
73+
if ($Version) {
74+
Write-Host " No release found for Chrome $Version."
75+
}
76+
exit 1
77+
}
78+
79+
$fileName = [System.IO.Path]::GetFileName($downloadUrl)
80+
$tempFile = Join-Path $env:TEMP $fileName
81+
82+
# Extract version from filename: botbrowser_20260210_145.0.7632.46_win_x86_64.7z
83+
$detectedVersion = if ($fileName -match 'botbrowser_\d+_(\d+\.\d+\.\d+\.\d+)_') { $Matches[1] } else { "unknown" }
84+
85+
Write-Host " Version: $detectedVersion"
86+
Write-Host "2. Downloading..."
87+
88+
$ProgressPreference = 'SilentlyContinue'
89+
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempFile -UseBasicParsing
90+
$ProgressPreference = 'Continue'
91+
92+
Write-Host " Saved to: $tempFile"
93+
94+
# Create install directory
95+
if (-not (Test-Path $InstallDir)) {
96+
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
97+
}
98+
99+
Write-Host "3. Extracting to $InstallDir ..."
100+
101+
# Find 7-Zip
102+
$sevenZip = Get-Command "7z" -ErrorAction SilentlyContinue
103+
if (-not $sevenZip) {
104+
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
105+
if (Test-Path $sevenZipPath) {
106+
$sevenZip = Get-Command $sevenZipPath
107+
}
108+
}
109+
110+
if ($sevenZip) {
111+
& $sevenZip.Source x $tempFile -o"$InstallDir" -y | Out-Null
112+
} else {
113+
Write-Host "Error: 7-Zip is required to extract .7z files."
114+
Write-Host " Install from: https://www.7-zip.org/"
115+
Write-Host " Or extract manually: $tempFile"
116+
exit 1
117+
}
118+
119+
Write-Host "4. Cleaning up..."
120+
Remove-Item $tempFile -Force
121+
122+
$chromePath = Join-Path $InstallDir "chrome.exe"
123+
Write-Host ""
124+
Write-Host "Installation complete! BotBrowser $detectedVersion"
125+
Write-Host "Location: $InstallDir"
126+
if (Test-Path $chromePath) {
127+
Write-Host "Executable: $chromePath"
128+
}

0 commit comments

Comments
 (0)