-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-platform.sh
More file actions
executable file
·61 lines (55 loc) · 1.52 KB
/
check-platform.sh
File metadata and controls
executable file
·61 lines (55 loc) · 1.52 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
#!/bin/bash
set -euo pipefail
echo "=== Platform Detection ==="
# Detect OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "OS: Linux"
PLATFORM="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "OS: macOS"
PLATFORM="macos"
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo "OS: Windows (Cygwin)"
PLATFORM="windows"
elif [[ "$OSTYPE" == "msys" ]]; then
echo "OS: Windows (MSYS/Git Bash)"
PLATFORM="windows"
elif [[ "$OSTYPE" == "win32" ]]; then
echo "OS: Windows"
PLATFORM="windows"
else
echo "OS: Unknown ($OSTYPE)"
PLATFORM="unknown"
fi
# Check Docker
if command -v docker &> /dev/null; then
echo "Docker: Installed ($(docker --version))"
if docker ps &> /dev/null; then
echo "Docker: Running"
else
echo "Docker: Not running or permission denied"
fi
else
echo "Docker: Not installed"
exit 1
fi
# Check Docker Compose
if command -v docker-compose &> /dev/null; then
echo "Docker Compose: Installed ($(docker-compose --version))"
elif docker compose version &> /dev/null; then
echo "Docker Compose: Installed ($(docker compose version))"
echo "Note: Using 'docker compose' command"
else
echo "Docker Compose: Not installed"
exit 1
fi
# WSL2 detection (Windows only)
if [[ "$PLATFORM" == "windows" ]]; then
if grep -qi microsoft /proc/version 2>/dev/null; then
echo "WSL: Running in WSL2"
echo "Docker Desktop: Using WSL2 integration"
else
echo "WSL: Not detected"
fi
fi
echo "=== Platform check complete ==="