-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·84 lines (68 loc) · 1.83 KB
/
install.sh
File metadata and controls
executable file
·84 lines (68 loc) · 1.83 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -e
# Temper CLI installer
# Usage: curl -fsSL https://tempercode.dev/install.sh | bash
REPO="handcraftbyte/temper-cli"
INSTALL_DIR="${TEMPER_INSTALL_DIR:-/usr/local/bin}"
BASE_URL="https://github.com/$REPO/releases/latest/download"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
info() {
echo -e "${BLUE}==>${NC} $1"
}
success() {
echo -e "${GREEN}==>${NC} $1"
}
error() {
echo -e "${RED}error:${NC} $1"
exit 1
}
# Detect OS
detect_os() {
case "$(uname -s)" in
Darwin*) echo "darwin" ;;
Linux*) echo "linux" ;;
MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
*) error "Unsupported operating system: $(uname -s)" ;;
esac
}
# Detect architecture
detect_arch() {
case "$(uname -m)" in
x86_64|amd64) echo "x64" ;;
arm64|aarch64) echo "arm64" ;;
*) error "Unsupported architecture: $(uname -m)" ;;
esac
}
OS=$(detect_os)
ARCH=$(detect_arch)
# Build download URL
if [ "$OS" = "windows" ]; then
BINARY_NAME="temper-${OS}-${ARCH}.exe"
TARGET_NAME="temper.exe"
else
BINARY_NAME="temper-${OS}-${ARCH}"
TARGET_NAME="temper"
fi
DOWNLOAD_URL="${BASE_URL}/${BINARY_NAME}"
info "Detected: $OS-$ARCH"
info "Downloading from: $DOWNLOAD_URL"
# Create install directory
sudo mkdir -p "$INSTALL_DIR"
# Download binary to temp location first, then move with sudo
TEMP_FILE=$(mktemp)
if command -v curl &> /dev/null; then
curl -fsSL "$DOWNLOAD_URL" -o "$TEMP_FILE"
elif command -v wget &> /dev/null; then
wget -q "$DOWNLOAD_URL" -O "$TEMP_FILE"
else
error "Neither curl nor wget found. Please install one of them."
fi
# Move to install directory with sudo
sudo mv "$TEMP_FILE" "$INSTALL_DIR/$TARGET_NAME"
sudo chmod +x "$INSTALL_DIR/$TARGET_NAME"
success "Installed temper to $INSTALL_DIR/$TARGET_NAME"
success "Installation complete! Run 'temper --help' to get started."