-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (41 loc) · 1.18 KB
/
install.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.18 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
#!/bin/bash
set -e
# Detect OS
OS="$(uname -s)"
case "${OS}" in
Linux*) OS=linux;;
Darwin*) OS=darwin;;
MINGW*) OS=windows;;
*) echo "Unsupported OS: ${OS}"; exit 1;;
esac
# Detect Architecture
ARCH="$(uname -m)"
case "${ARCH}" in
x86_64) ARCH=amd64;;
aarch64) ARCH=arm64;;
arm64) ARCH=arm64;;
*) echo "Unsupported architecture: ${ARCH}"; exit 1;;
esac
# Determine asset name
if [ "$OS" = "windows" ]; then
ASSET_NAME="craft-${OS}-${ARCH}.exe"
else
ASSET_NAME="craft-${OS}-${ARCH}"
fi
# GitHub Release URL (latest)
DOWNLOAD_URL="https://github.com/craftpkg/craft/releases/latest/download/${ASSET_NAME}"
echo "Downloading Craft for ${OS}/${ARCH}..."
if ! curl -L -o craft "${DOWNLOAD_URL}" --fail; then
echo "Error: Failed to download ${ASSET_NAME} from ${DOWNLOAD_URL}"
echo "Please ensure the release exists and the asset name is correct."
exit 1
fi
chmod +x craft
echo "Installing to /usr/local/bin (requires sudo)..."
if [ -w /usr/local/bin ]; then
mv craft /usr/local/bin/craft
else
sudo mv craft /usr/local/bin/craft
fi
echo "✅ Craft installed successfully!"
echo "Try running: craft --help"