forked from AndyTaylorTweet/Pi-Star_Binaries_sbin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pistar-mmdvmremote
executable file
·72 lines (65 loc) · 2.08 KB
/
pistar-mmdvmremote
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 MMDVMHost Remote Tool #
# #
# Version 1.0, Code, Design and Development by Andy Taylor (MW0MWZ). #
# #
# Make it simple to use the MMDVM Remote from the CLI on Pi-Star. #
# #
##############################################################################
#
if [ "$(id -u)" != "0" ]; then
echo -e "You need to be root to run this command...\n"
exit 1
fi
# Setup some variables
cmd=/usr/local/bin/RemoteCommand
port=$(sed -n '/^\[Remote Control\]/,/^\[/p' /etc/mmdvmhost | grep "^Port" | awk -F "=" '{print $2}')
if [ -z "$1" ]; then
echo "This is a wrapper script to make it more simple to use the MMDVMHost"
echo "RemoteCommand tool by figuring out the port from the MMDVMHost config"
echo "and helping to fill in some of the commands for you."
echo ""
echo "You can use this tool to sed the mode to:"
echo "Idle, Lockout, D-Star, DMR, YSF, P25 or NXDN"
echo ""
echo "Simply run pistar-mmdvmremote followed by one of the above, so for"
echo "example \"pistar-mmdvmremote lockout\""
echo ""
exit 0
fi
if [ ${1} ]; then
# Make the input lower case
inputcmd=$(echo ${1} | tr '[:upper:]' '[:lower:]')
case ${inputcmd} in
idle)
${cmd} ${port} mode idle
;;
lockout)
${cmd} ${port} mode lockout
;;
d-star)
${cmd} ${port} mode d-star
;;
dmr)
${cmd} ${port} mode dmr
;;
ysf)
${cmd} ${port} mode ysf
;;
p25)
${cmd} ${port} mode p25
;;
nxdn)
${cmd} ${port} mode nxdn
;;
*)
echo "Command not understood..."
;;
esac
# Cleanup any left over logs that are dropped all over the place...
rm -rf RemoteCommand-*.log > /dev/null 2>&1
fi
exit 0