-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·56 lines (42 loc) · 1.43 KB
/
install.sh
File metadata and controls
executable file
·56 lines (42 loc) · 1.43 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
#!/bin/bash
# Installation script for xdebug-cli
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
INSTALL_DIR="${HOME}/.local/bin"
BINARY_NAME="xdebug-cli"
VERSION="1.0.2"
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
echo -e "${GREEN}=== Xdebug CLI Installation ===${NC}"
# Check Go
if ! command -v go &> /dev/null; then
echo -e "${RED}Error: Go is not installed.${NC}"
exit 1
fi
GO_VERSION=$(go version | awk '{print $3}')
echo -e "Found Go: ${GREEN}${GO_VERSION}${NC}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo -e "${YELLOW}Downloading dependencies...${NC}"
go mod download
echo -e "${YELLOW}Building ${BINARY_NAME} v${VERSION}...${NC}"
LDFLAGS="-X github.com/console/xdebug-cli/internal/cfg.Version=${VERSION} -X github.com/console/xdebug-cli/internal/cli.BuildTime=${BUILD_TIME}"
go build -ldflags "${LDFLAGS}" -o "${BINARY_NAME}" ./cmd/xdebug-cli
if [ ! -f "${BINARY_NAME}" ]; then
echo -e "${RED}Error: Build failed${NC}"
exit 1
fi
if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p "$INSTALL_DIR"
fi
mv "${BINARY_NAME}" "${INSTALL_DIR}/"
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
echo -e "${GREEN}Installation complete!${NC}"
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
echo -e "${YELLOW}Warning: ${INSTALL_DIR} is not in your PATH${NC}"
echo 'Add: export PATH="$HOME/.local/bin:$PATH"'
fi
echo -e "${GREEN}Run 'xdebug-cli version' to verify${NC}"