-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·36 lines (27 loc) · 791 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·36 lines (27 loc) · 791 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
REPO="Scratchhhh/vtfedit-mac"
ASSET="VTFEdit-macOS.zip"
APP="VTFEdit.app"
URL="https://github.com/$REPO/releases/latest/download/$ASSET"
if [ "$(uname)" != "Darwin" ]; then
echo "VTFEdit for Mac runs on macOS only." >&2
exit 1
fi
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
echo "Downloading the latest release…"
curl -fsSL "$URL" -o "$TMP/$ASSET"
echo "Unpacking…"
ditto -x -k "$TMP/$ASSET" "$TMP"
DEST="/Applications"
if [ ! -w "$DEST" ]; then
DEST="$HOME/Applications"
mkdir -p "$DEST"
fi
rm -rf "$DEST/$APP"
mv "$TMP/$APP" "$DEST/"
# Clear the Gatekeeper quarantine flag so it opens without a right-click.
xattr -dr com.apple.quarantine "$DEST/$APP" 2>/dev/null || true
echo "Installed to $DEST/$APP"
open "$DEST/$APP"