-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_latest.sh
More file actions
executable file
·51 lines (40 loc) · 1.67 KB
/
install_latest.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.67 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
#!/bin/bash
# Shark Installer - Downloads the latest Shark DMG from GitHub
set -e
REPO_OWNER="SSBun"
REPO_NAME="Shark"
APP_NAME="Shark"
echo "Fetching latest release from GitHub..."
# Try GitHub API first
RELEASE_JSON=$(curl -sL "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" 2>/dev/null)
if echo "$RELEASE_JSON" | grep -q "browser_download_url"; then
# API worked - extract DMG URL
DMG_URL=$(echo "$RELEASE_JSON" | grep -o '"browser_download_url" *: *"[^"]*\.dmg"' | grep -v sha256 | head -1 | sed 's/.*"browser_download_url" *: *"\([^"]*\)".*/\1/')
else
# Fallback: Use GitHub redirect to get latest tag
LATEST_URL=$(curl -sL "https://github.com/$REPO_OWNER/$REPO_NAME/releases/latest" -w "%{url_effective}" -o /dev/null)
TAG=$(echo "$LATEST_URL" | sed 's/.*\/tag\///')
VERSION=$(echo "$TAG" | sed 's/^v//')
DMG_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$TAG/$APP_NAME-$VERSION.dmg"
fi
if [ -z "$DMG_URL" ]; then
echo "Error: Could not find DMG file"
echo "Please download manually from: https://github.com/$REPO_OWNER/$REPO_NAME/releases"
exit 1
fi
# Extract version from URL
DMG_VERSION=$(echo "$DMG_URL" | sed 's/.*\(Shark-[0-9.]*\.dmg\).*/\1/')
# Download to Downloads folder
DOWNLOADS_DIR="$HOME/Downloads"
DMG_PATH="$DOWNLOADS_DIR/$DMG_VERSION"
echo "Downloading: $DMG_URL"
curl -sL "$DMG_URL" -o "$DMG_PATH"
echo "Opening DMG file..."
open "$DMG_PATH"
echo ""
echo "Installation Steps:"
echo "1. Drag Shark.app to your Applications folder"
echo "2. If macOS shows 'Shark is damaged' error, run:"
echo " xattr -rd com.apple.quarantine /Applications/Shark.app"
echo ""
echo "Download complete: $DMG_PATH"