-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathpistar-link
executable file
·55 lines (50 loc) · 1.78 KB
/
pistar-link
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
#!/bin/bash
#
##############################################################################
# #
# Pi-Star ircDDBGateway link Tool #
# #
# Version 1.0, Code, Design and Development by Andy Taylor (MW0MWZ). #
# #
# Make it simple to link reflectors from the CLI on Pi-Star. #
# Origional suggestion by Adrian (VK4TUX) #
# #
##############################################################################
#
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/remotecontrold
module=$(grep -m 1 'callsign=' /etc/dstarrepeater | awk -F "=" '/callsign/ {print $2}')
if [ -z "$1" ]
then
echo "To unlink from any connected reflector, use: pistar-link unlink"
echo "To link to REF000 A for example, use: pistar-link ref000_a"
echo ""
echo "If you need to make a reflector FIXED so that users cannot unlink,"
echo "for schedulling connections via CRON for example you can use the"
echo "the following: pistar-link ref000_a fixed"
echo "Should you wish to Un-Fix a reflector, relink to the same reflector"
echo "without the fixed flag, such as: pistar-link ref000_a"
echo ""
exit 0
fi
if [ -z "$2" ]
then
relink=never
else
relink=${2}
fi
case ${1} in
*unlink)
${cmd} "${module}" unlink
exit 0
;;
*)
${cmd} "${module}" link ${relink} $1
exit 0
;;
esac
exit 0