-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
54 lines (41 loc) · 1.37 KB
/
install.sh
File metadata and controls
54 lines (41 loc) · 1.37 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
#!/bin/bash
set -e
# Simple installer for commit-celebration
REPO="divyanshusahu/commit-celebration"
INSTALL_DIR="$HOME/.local/bin"
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $OS in
"darwin") OS="darwin" ;;
"linux") OS="linux" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
case $ARCH in
"x86_64"|"amd64") ARCH="amd64" ;;
"arm64"|"aarch64") ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
echo "Installing commit-celebration for $OS-$ARCH..."
# Create install directory
mkdir -p "$INSTALL_DIR"
# Download binary
BINARY_PATH="$INSTALL_DIR/commit-celebration"
DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/commit-celebration-$OS-$ARCH"
curl -L -o "$BINARY_PATH" "$DOWNLOAD_URL" || {
echo "Download failed. Make sure you have curl installed."
exit 1
}
chmod +x "$BINARY_PATH"
echo "✅ Installed to $BINARY_PATH"
echo ""
echo "Ensuring $INSTALL_DIR is on your PATH..."
case :$PATH: in
*:"$INSTALL_DIR":*) ;;
*) echo "Note: $INSTALL_DIR is not on your PATH. Add it for easier use." ;;
esac
echo "Configuring global git hook (commit-celebration install)..."
"$BINARY_PATH" install || {
echo "Failed to set up global git hook. You can retry later with: commit-celebration install"
}
echo "🎉 Setup complete. Make a commit in any repo to hear the celebration!"