-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
62 lines (48 loc) · 1.55 KB
/
install.sh
File metadata and controls
62 lines (48 loc) · 1.55 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
#!/bin/sh
# Envault CLI - Universal Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/DinanathDash/Envault/main/install.sh | sh
set -e
REPO="DinanathDash/Envault"
BINARY_NAME="envault"
INSTALL_DIR="/usr/local/bin"
# Detect OS
OS="$(uname -s)"
case "$OS" in
Linux) OS_NAME="Linux" ;;
Darwin) OS_NAME="Darwin" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
# Detect Architecture
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH_NAME="x86_64" ;;
arm64|aarch64) ARCH_NAME="arm64" ;;
*) echo "Unsupported Architecture: $ARCH"; exit 1 ;;
esac
# Fetch latest version from GitHub API
VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$VERSION" ]; then
echo "Could not fetch latest version. Please check your internet connection."
exit 1
fi
FILE_NAME="envault_${OS_NAME}_${ARCH_NAME}.tar.gz"
URL="https://github.com/$REPO/releases/download/$VERSION/$FILE_NAME"
echo "Downloading Envault CLI $VERSION for $OS_NAME $ARCH_NAME..."
# Create temp directory
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
# Download and extract
curl -sSL "$URL" -o "$FILE_NAME"
tar -xzf "$FILE_NAME"
# Install binary
echo "Installing to $INSTALL_DIR/$BINARY_NAME..."
if [ -w "$INSTALL_DIR" ]; then
mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
else
echo "Permission denied. Attempting with sudo..."
sudo mv "$BINARY_NAME" "$INSTALL_DIR/$BINARY_NAME"
fi
# Cleanup
rm -rf "$TMP_DIR"
echo "Envault CLI installed successfully!"
echo "Run 'envault --version' to verify."