-
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 (42 loc) · 1.11 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.11 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
# Installation script for prom2sar
set -e
INSTALL_DIR="/usr/local/bin"
BINARY_NAME="prom2sar"
echo "=== prom2sar Installation ==="
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "This script requires sudo/root privileges to install to ${INSTALL_DIR}"
echo "Please run: sudo ./install.sh"
exit 1
fi
# Build the binary if it doesn't exist
if [ ! -f "bin/${BINARY_NAME}" ]; then
echo "Binary not found. Building..."
make build-cli
fi
# Verify binary exists
if [ ! -f "bin/${BINARY_NAME}" ]; then
echo "Error: Failed to build binary"
exit 1
fi
# Install
echo "Installing ${BINARY_NAME} to ${INSTALL_DIR}..."
cp "bin/${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
# Verify installation
if command -v ${BINARY_NAME} &> /dev/null; then
echo ""
echo "✓ Installation successful!"
echo ""
echo "Installed: $(which ${BINARY_NAME})"
echo "Version: $(${BINARY_NAME} --version)"
echo ""
echo "Try it:"
echo " ${BINARY_NAME} --help"
echo ""
else
echo "Error: Installation failed"
exit 1
fi