-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
Β·43 lines (33 loc) Β· 1.11 KB
/
install.sh
File metadata and controls
executable file
Β·43 lines (33 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
#!/usr/bin/env bash
set -e
APP_NAME="gopulse"
BIN_DIR="bin"
INSTALL_PATH="/usr/local/bin/${APP_NAME}"
# --- Colors ---
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}π Installing ${APP_NAME}...${NC}"
# --- Check Go installation ---
if ! command -v go >/dev/null 2>&1; then
echo -e "${RED}β Go is not installed. Please install Go first.${NC}"
exit 1
fi
# --- Prepare and fetch dependencies ---
if [ ! -f "go.mod" ]; then
echo -e "${RED}β No go.mod found. Please run this script from the project root.${NC}"
exit 1
fi
echo -e "${YELLOW}π¦ Ensuring Go dependencies are downloaded...${NC}"
go mod tidy
go mod download
# --- Build the binary ---
echo -e "${YELLOW}ποΈ Building ${APP_NAME}...${NC}"
mkdir -p "${BIN_DIR}"
go build -o "${BIN_DIR}/${APP_NAME}" ./cmd/${APP_NAME}
# --- Install the binary ---
echo -e "${YELLOW}π¦ Installing to ${INSTALL_PATH}...${NC}"
sudo install -m755 "${BIN_DIR}/${APP_NAME}" "${INSTALL_PATH}"
echo -e "${GREEN}β
${APP_NAME} installed successfully!${NC}"
echo -e "${GREEN}π Run '${APP_NAME}' to start using it.${NC}"