-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidate_install.sh
More file actions
executable file
·130 lines (111 loc) · 3.4 KB
/
validate_install.sh
File metadata and controls
executable file
·130 lines (111 loc) · 3.4 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# MeshC2 Installation Validation Script
# Run this after installation to verify everything is working
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[CHECK]${NC} $1"
}
print_success() {
echo -e "${GREEN}[PASS]${NC} $1"
}
print_error() {
echo -e "${RED}[FAIL]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
echo "=== MeshC2 Installation Validation ==="
echo
# Check if service user exists
print_status "Checking service user..."
if id meshc2 &>/dev/null; then
print_success "Service user 'meshc2' exists"
else
print_error "Service user 'meshc2' not found"
fi
# Check if directories exist
print_status "Checking directories..."
directories=("/opt/meshc2" "/etc/meshc2" "/var/log/meshc2" "/var/lib/meshc2")
for dir in "${directories[@]}"; do
if [[ -d "$dir" ]]; then
print_success "Directory exists: $dir"
else
print_error "Directory missing: $dir"
fi
done
# Check if files exist
print_status "Checking critical files..."
files=(
"/opt/meshc2/src/meshtastic_troubleshoot/main.py"
"/opt/meshc2/venv/bin/python"
"/etc/systemd/system/meshc2.service"
"/usr/local/bin/meshc2"
)
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
print_success "File exists: $file"
else
print_error "File missing: $file"
fi
done
# Check if virtual environment works
print_status "Testing virtual environment..."
if /opt/meshc2/venv/bin/python -c "import meshtastic; print('Meshtastic library OK')" 2>/dev/null; then
print_success "Virtual environment and dependencies OK"
else
print_error "Virtual environment or dependencies issue"
fi
# Check if service is configured
print_status "Checking systemd service..."
if systemctl list-unit-files | grep -q meshc2.service; then
print_success "Systemd service is configured"
if systemctl is-enabled meshc2.service &>/dev/null; then
print_success "Service is enabled"
else
print_warning "Service is not enabled (run: sudo systemctl enable meshc2)"
fi
if systemctl is-active meshc2.service &>/dev/null; then
print_success "Service is running"
else
print_warning "Service is not running (run: sudo systemctl start meshc2)"
fi
else
print_error "Systemd service not found"
fi
# Check if command wrapper works
print_status "Testing command wrapper..."
if command -v meshc2 &>/dev/null; then
print_success "meshc2 command is available"
if meshc2 --help &>/dev/null; then
print_success "meshc2 command executes successfully"
else
print_error "meshc2 command execution failed"
fi
else
print_error "meshc2 command not found in PATH"
fi
# Check for Meshtastic devices
print_status "Checking for Meshtastic devices..."
if ls /dev/ttyUSB* &>/dev/null || ls /dev/ttyACM* &>/dev/null; then
print_success "Serial devices found"
# Try to list devices
if meshc2 --list-devices &>/dev/null; then
print_success "Device detection working"
else
print_error "Device detection failed"
fi
else
print_warning "No serial devices found (connect Meshtastic device)"
fi
echo
echo "=== Validation Complete ==="
echo
echo "If any checks failed, try:"
echo "1. Re-run the installer: sudo ./install.sh"
echo "2. Check logs: sudo journalctl -u meshc2"
echo "3. Manual service start: sudo systemctl start meshc2"
echo