This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmk-dmrlink
executable file
·163 lines (137 loc) · 5.32 KB
/
mk-dmrlink
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#! /bin/bash
PREFIX=/opt/dmrlink
echo "DMRlink will be installed in: $PREFIX"
currentdir=`pwd`
echo "Current working directory is: $currentdir"
echo ""
#################################################
# #
# Install DMRlink in seperate directories by #
# Application #
#################################################
# Install the required support programs
distro=$(lsb_release -i | awk -F":" '{ gsub(/^[ \t]+/, "", $2); print $2 }')
release=$(lsb_release -r | awk -F":" '{ gsub(/^[ \t]+/, "", $2); print $2 }')
echo "Current Linux distribution is: $distro $release"
if [[ "$distro" =~ ^(CentOS|Fedora|openSUSE|)$ ]]; then
echo "$distro uses yum"
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(echo $release | awk -F"." '{print $1}').noarch.rpm
yum install -y gcc gcc-c++ glibc-devel make
yum install -y unzip
yum install -y python-devel
yum install -y python-pip
yum install -y python-twisted
# pip install bitstring
# pip install bitarray
else
echo "$distro uses apt"
apt-get install -y build-essential
apt-get install -y unzip
apt-get install -y python-dev
apt-get install -y python-pip
apt-get install -y python-twisted
# pip install bitstring
# pip install bitarray
fi
# Install dmr_utils with pip install
pip install dmr_utils
###############################################################################
# Following lines should be removed due to the pip install method for dmr_utils
#cd /opt
#if [ ! -d /opt/dmr_utils ]; then
# git clone https://github.com/n0mjs710/dmr_utils.git
#fi
#cd dmr_utils/
#git pull
#pip install .
###############################################################################
echo "Required programs installed, continuing"
# To allow multiple instances of DMRlink to run
# You need multiple ipsc directories, dmrlink.py and dmrlink.cfg
# The needed files are copied to /opt/dmrlink
# Make needed directories
mkdir -p $PREFIX/confbridge/
mkdir -p $PREFIX/playback/
mkdir -p $PREFIX/proxy/
mkdir -p $PREFIX/samples
mkdir -p /var/log/dmrlink
cd $PREFIX
# Put common files in /opt/dmrlink
# cp $currentdir/peer_ids.csv /opt/dmrlink
# cp $currentdir/subscriber_ids.csv /opt/dmrlink
# cp $currentdir/talkgroup_ids.csv /opt/dmrlink
# Copy ipsc directory into each app directory
cp -rf $currentdir/ipsc/ $PREFIX/confbridge/
cp -rf $currentdir/ipsc/ $PREFIX/playback/
cp -rf $currentdir/ipsc/ $PREFIX/proxy/
# Put a copy of the samples together for easy reference
#cp $currentdir/bridge_rules_SAMPLE.py /opt/dmrlink/samples
cp $currentdir/confbridge_rules_SAMPLE.py $PREFIX/samples
cp $currentdir/dmrlink_SAMPLE.cfg $PREFIX/samples
#cp $currentdir/known_bridges_SAMPLE.py /opt/dmrlink/samples
cp $currentdir/playback_config_SAMPLE.py $PREFIX/samples
#cp $currentdir/ambe_audio.cfg /opt/dmrlink/samples
cp $currentdir/sub_acl_SAMPLE.py /opt/dmrlink/samples
# Put the doc together for easy reference
cp -rf $currentdir/documents $PREFIX
cp $currentdir/LICENSE.txt $PREFIX/documents
cp $currentdir/requirements.txt $PREFIX/documents
#cp $currentdir/ambe_audio_commands.txt /opt/dmrlink/documents
# ambe_audio
#cp $currentdir/dmrlink.py /opt/dmrlink/ambe_audio/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/ambe_audio/
#
#cp $currentdir/ambe_audio.cfg /opt/dmrlink/ambe_audio/
#cp $currentdir/ambe_audio.py /opt/dmrlink/ambe_audio/
#cp $currentdir/ambe_audio_commands.txt /opt/dmrlink/ambe_audio/
#cp $currentdir/template.bin /opt/dmrlink/ambe_audio/
# Bridge app
#cp $currentdir/dmrlink.py /opt/dmrlink/bridge/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/bridge/
#
#cp $currentdir/bridge.py /opt/dmrlink/bridge/
#cp $currentdir/bridge_rules_SAMPLE.py /opt/dmrlink/bridge/
#cp $currentdir/known_bridges_SAMPLE.py /opt/dmrlink/bridge/
#cp $currentdir/sub_acl_SAMPLE.py /opt/dmrlink/bridge/
# ConfBridge app
cp $currentdir/dmrlink.py $PREFIX/confbridge/
cp $currentdir/dmrlink_SAMPLE.cfg $PREFIX/confbridge/
#
cp $currentdir/confbridge.py $PREFIX/confbridge/
cp $currentdir/confbridge_rules_SAMPLE.py $PREFIX/confbridge/
#cp $currentdir/known_bridges_SAMPLE.py /opt/dmrlink/confbridge/
cp $currentdir/sub_acl_SAMPLE.py $PREFIX/confbridge/
# Log app
#cp $currentdir/dmrlink.py /opt/dmrlink/log/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/log/
#
#cp $currentdir/log.py /opt/dmrlink/log/
# Playback (Parrot)
cp $currentdir/dmrlink.py $PREFIX/playback/
cp $currentdir/dmrlink_SAMPLE.cfg $PREFIX/playback/
#
cp $currentdir/playback.py $PREFIX/playback/
cp $currentdir/playback_config_SAMPLE.py $PREFIX/playback/
# Play Group app
#cp $currentdir/dmrlink.py /opt/dmrlink/play_group/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/play_group/
#
#cp $currentdir/play_group.py /opt/dmrlink/play_group/
# proxy app
cp $currentdir/dmrlink.py $PREFIX/proxy/
cp $currentdir/dmrlink_SAMPLE.cfg $PREFIX/proxy/
#
cp $currentdir/proxy.py $PREFIX/proxy/
#cp $currentdir/known_bridges_SAMPLE.py $PREFIX/proxy/
cp $currentdir/sub_acl_SAMPLE.py $PREFIX/proxy/
# rcm app
#cp $currentdir/dmrlink.py /opt/dmrlink/rcm/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/rcm/
#
#cp $currentdir/rcm_db_log.py /opt/dmrlink/rcm/
#cp $currentdir/rcm.py /opt/dmrlink/rcm/
# record app
#cp $currentdir/dmrlink.py /opt/dmrlink/record/
#cp $currentdir/dmrlink_SAMPLE.cfg /opt/dmrlink/record/
#
#cp $currentdir/record.py /opt/dmrlink/record/