-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathpistar-mmdvmcal
executable file
·72 lines (61 loc) · 2.31 KB
/
pistar-mmdvmcal
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
#!/bin/bash
#
##############################################################################
# #
# Pi-Star MMDVMCal Tool #
# #
# Version 1.1, Code, Design and Development by Andy Taylor (MW0MWZ). #
# #
# Make it simple to run MMDVMCal on Pi-Star. #
# Orrigional suggestion by "mrickey" #
# #
##############################################################################
#
if [ "$(id -u)" != "0" ]; then
echo -e "You need to be root to run this command...\n"
exit 1
fi
# Get the modem port from /etc/mmdvmhost
mmdvmModem=$(grep -m 1 'UARTPort=' /etc/mmdvmhost | awk -F "=" '/Port/ {print $2}')
modemSpeed=$(grep -m 1 'UARTSpeed=' /etc/mmdvmhost | awk -F "=" '/UARTSpeed/ {print $2}')
# Output some feedback to the terminal
echo "Stopping Pi-Star Services..."
# Make the disk RW
if [ -d /boot/firmware ]; then
(sudo mount -o remount,rw / 2>/dev/null)
else
mount -o remount,rw /
fi
# Stop the services
systemctl stop pistar-watchdog.timer
systemctl stop pistar-watchdog.service
systemctl stop mmdvmhost.timer
systemctl stop mmdvmhost.service
sleep 3
# Force Kill any remaining MMDVMHost processes
echo "Killing any remaining MMDVMHost processes..."
killall MMDVMHost
killall MMDVMHost_NoOLED
killall MMDVMHost_Adafruit
# Output some feedback to the terminal
echo "Starting Calibration..."
# Run MMDVMCal twice, killing the first one after 3 secs
/usr/local/bin/MMDVMCal ${modemSpeed} ${mmdvmModem} >/dev/null 2>&1 &
sleep 3
killall MMDVMCal >/dev/null 2>&1
/usr/local/bin/MMDVMCal ${modemSpeed} ${mmdvmModem}
# Output some feedback to the terminal
echo "Starting Pi-Star Services..."
# Set the disk back to RO on MMDVMCal exit
if [ -d /boot/firmware ]; then
(sudo mount -o remount,ro / 2>/dev/null)
else
mount -o remount,ro /
fi
# Start the services
systemctl start pistar-watchdog.timer
systemctl start pistar-watchdog
systemctl start mmdvmhost.timer
systemctl start mmdvmhost
# Complete
echo "Finnished..."