DMRlink/mk_dmrlink
2015-12-04 06:06:35 -05:00

117 lines
4.1 KiB
Bash
Executable File

#! /bin/sh
#################################################
# #
# Create directory structure for DMRlink #
# #
#################################################
apt-get install unzip -y
apt-get install python-twisted -y
# 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 /opt/dmrlink/ambe_audio/ipsc
mkdir -p /opt/dmrlink/bridge/ipsc
mkdir -p /opt/dmrlink/gateway/ipsc
mkdir -p /opt/dmrlink/log/ipsc
mkdir -p /opt/dmrlink/playback/ipsc
mkdir -p /opt/dmrlink/play_group/ipsc
mkdir -p /opt/dmrlink/record/ipsc
mkdir -p /opt/dmrlink/rcm/ipsc
mkdir -p /opt/dmrlink/doc
mkdir -p /opt/dmrlink/samples
mkdir -p /var/log/dmrlink
# Put scripts in /opt/dmrlink
cp /srv/DMRlink/get_ids.sh /opt/dmrlink # should be linked to /etc/cron.daily
cp /srv/DMRlink/init.d/bridge /opt/dmrlink/rc.bridge
# bitstring install
cd /opt/dmrlink
wget https://pypi.python.org/packages/source/b/bitstring/bitstring-3.1.3.zip
unzip bitstring-3.1.3.zip
cd bitstring-3.1.3
python setup.py install
cd /opt/dmrlink
rm bitstring-3.1.3.zip
# Put common files in /opt/dmrlink
cp /srv/DMRlink/subscriber_ids.csv /opt/dmrlink
cp /srv/DMRlink/subscriber_idsxxx.csv /opt/dmrlink
cp /srv/DMRlink/talkgroup_ids.csv /opt/dmrlink
cp /srv/DMRlink/peer_ids.csv /opt/dmrlink
cp /srv/DMRlink/get_ids.sh /opt/dmrlink
# Copy ipsc directory into each app directory
cp /srv/DMRlink/ipsc/* /opt/dmrlink/ambe_audio/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/bridge/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/gateway/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/log/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/playback/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/play_group/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/record/ipsc
cp /srv/DMRlink/ipsc/* /opt/dmrlink/rcm/ipsc
# Put the samples together for easy ref
cp /srv/DMRlink/bridge_rules_SAMPLE.py /opt/dmrlink/samples
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/samples
cp /srv/DMRlink/known_bridges_SAMPLE.py /opt/dmrlink/samples
cp /srv/DMRlink/playback_config_SAMPLE.py /opt/dmrlink/samples
# Put the doc together for easy ref
cp /srv/DMRlink/FAQ.md /opt/dmrlink/doc
cp /srv/DMRlink/internal_data_decode.txt /opt/dmrlink/doc
cp /srv/DMRlink/LICENSE.txt /opt/dmrlink/doc
cp /srv/DMRlink/README.md /opt/dmrlink/doc
cp /srv/DMRlink/requirements.txt /opt/dmrlink/doc
# Stock ambe_audio
cp /srv/DMRlink/ambe_audio.cfg /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/ambe_audio.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/ambe_audio/dmrlink.cfg
# ambe_audio for DMRGateway
cp /srv/DMRlink/ambe_audio.cfg /opt/dmrlink/gateway/
cp /srv/DMRlink/ambe_audio.py /opt/dmrlink/gateway/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/gateway/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/gateway/dmrlink.cfg
# Bridge app
cp /srv/DMRlink/bridge.py /opt/dmrlink/bridge/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/bridge/
cp /srv/DMRlink/bridge_rules_SAMPLE.py /opt/dmrlink/bridge/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/bridge/dmrlink.cfg
# Log app
cp /srv/DMRlink/log.py /opt/dmrlink/log/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/log/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/log/dmrlink.cfg
# Playback (Parrot)
cp /srv/DMRlink/playback.py /opt/dmrlink/playback/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/playback/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/playback/dmrlink.cfg
# Play Group app
cp /srv/DMRlink/play_group.py /opt/dmrlink/play_group/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/play_group/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/play_group/dmrlink.cfg
# record app
cp /srv/DMRlink/record.py /opt/dmrlink/record/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/record/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/record/dmrlink.cfg
# rcm app
cp /srv/DMRlink/rcm_db_log.py /opt/dmrlink/rcm/
cp /srv/DMRlink/rcm.py /opt/dmrlink/rcm/
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/rcm/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/rcm/dmrlink.cfg
cp /srv/DMRlink/pickle_stat_reader.py /opt/dmrlink/rcm/