-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.sh
More file actions
executable file
·42 lines (34 loc) · 1.18 KB
/
Copy pathenv.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.18 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
#!/bin/bash
GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}Hugo blog environment check: ${NC}"
check_command() {
local cmd=$1
local description=$2
if command -v "$cmd" &> /dev/null; then
if [ "$cmd" = "go" ]; then
local version=$(go version 2>&1)
else
local version=$($cmd --version 2>&1 | head -n 1)
fi
echo -e "[${GREEN}OK${NC}] $description ($cmd) is installed. ($version)"
else
echo -e "[${RED}MISSING${NC}] $description ($cmd) is NOT installed!"
fi
}
check_command "git" "Git Version Control"
check_command "go" "Go Language (required for Hugo modules)"
if command -v hugo &> /dev/null; then
HUGO_VERSION=$(hugo version)
if [[ $HUGO_VERSION == *"extended"* ]]; then
echo -e "[${GREEN}OK${NC}] Hugo Static Site Generator (EXTENDED version detected). ($HUGO_VERSION)"
else
YEL='\033[0;33m'
echo -e "[${YEL}WARNING${NC}] Hugo is installed but it is NOT the 'extended' version. Your theme might fail to compile Sass/SCSS files."
fi
else
echo -e "[${RED}MISSING${NC}] Hugo is NOT installed!"
fi
check_command "node" "Node.js Runtime"