-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·59 lines (46 loc) · 1.55 KB
/
install.sh
File metadata and controls
executable file
·59 lines (46 loc) · 1.55 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
#!/usr/bin/env bash
set -euo pipefail
REPO="codecorrupt/brouter"
INSTALL_DIR="$HOME/Applications"
if [ "$(uname -s)" != "Darwin" ]; then
echo "This installer only works on macOS." >&2
exit 1
fi
if ! command -v curl >/dev/null 2>&1; then
echo "curl is required" >&2
exit 1
fi
if ! command -v unzip >/dev/null 2>&1; then
echo "unzip is required" >&2
exit 1
fi
mkdir -p "$INSTALL_DIR"
if ! LATEST_URL=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" \
| grep browser_download_url \
| grep -E 'Brouter-.*\.zip' \
| cut -d '"' -f 4); then
echo "Failed to determine download URL" >&2
exit 1
fi
echo "Downloading Brouter.app…"
TMP_DIR=$(mktemp -d)
trap 'rm -rf "$TMP_DIR"' EXIT
curl -fsSL "$LATEST_URL" -o "$TMP_DIR/Brouter.zip"
unzip -q "$TMP_DIR/Brouter.zip" -d "$TMP_DIR"
echo "Installing to $INSTALL_DIR"
rm -rf "$INSTALL_DIR/Brouter.app"
mv "$TMP_DIR/Brouter.app" "$INSTALL_DIR/"
echo "Removing quarantine attributes"
xattr -cr "$INSTALL_DIR/Brouter.app"
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/brouter"
CONFIG_FILE="$CONFIG_DIR/config"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Installing example config to $CONFIG_FILE"
mkdir -p "$CONFIG_DIR"
curl -fsSL "https://raw.githubusercontent.com/$REPO/main/src/example-config" -o "$CONFIG_FILE"
else
echo "Config already exists, leaving it untouched"
fi
echo "Installed Brouter."
echo "Next step: Run this command to open System Settings and set Brouter as your default browser:"
echo " open \"x-apple.systempreferences:com.apple.Desktop-Settings.extension?DefaultWebBrowser\""