DMRlink/mk-dmrlink
2017-04-03 13:33:33 -04:00

163 lines
5.9 KiB
Bash
Executable File

#! /bin/bash
#################################################
# #
# Install DMRlink in seperate directories by #
# Application #
#################################################
# Install the required support programs
apt-get install unzip -y
apt-get install python-dev -y
apt-get install python-pip -y
apt-get install python-twisted -y
pip install bitstring
pip install bitarray
cd /opt
git clone https://github.com/n0mjs710/dmr_utils.git
cd dmr_utils/
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
# 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
# Make needed directories
mkdir -p /opt/dmrlink/ambe_audio/
mkdir -p /opt/dmrlink/bridge/
mkdir -p /opt/dmrlink/confbridge/
mkdir -p /opt/dmrlink/log/
mkdir -p /opt/dmrlink/playback/
mkdir -p /opt/dmrlink/play_group/
mkdir -p /opt/dmrlink/record/
mkdir -p /opt/dmrlink/rcm/
mkdir -p /opt/dmrlink/samples
mkdir -p /var/log/dmrlink
cd /opt/dmrlink
# Put common files in /opt/dmrlink
cp /srv/DMRlink/get_ids.sh /opt/dmrlink
cp /srv/DMRlink/peer_ids.csv /opt/dmrlink
cp /srv/DMRlink/subscriber_ids.csv /opt/dmrlink
cp /srv/DMRlink/talkgroup_ids.csv /opt/dmrlink
# Copy ipsc directory into each app directory
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/ambe_audio/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/bridge/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/confbridge/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/log/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/playback/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/play_group/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/record/
cp -rf /srv/DMRlink/ipsc/ /opt/dmrlink/rcm/
# Put a copy of the samples together for easy reference
cp /srv/DMRlink/bridge_rules_SAMPLE.py /opt/dmrlink/samples
cp /srv/DMRlink/confbridge_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
cp /srv/DMRlink/ambe_audio.cfg /opt/dmrlink/samples
cp /srv/DMRlink/sub_acl_SAMPLE.py /opt/dmrlink/samples
# Put the doc together for easy reference
cp -rf /srv/DMRlink/documents /opt/dmrlink
cp /srv/DMRlink/LICENSE.txt /opt/dmrlink/documents
cp /srv/DMRlink/requirements.txt /opt/dmrlink/documents
cp /srv/DMRlink/ambe_audio_commands.txt /opt/dmrlink/documents
# ambe_audio
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/template.py /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/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/ambe_audio_commands.txt /opt/dmrlink/ambe_audio/
cp /srv/DMRlink/template.bin /opt/dmrlink/ambe_audio/
# Bridge app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/bridge/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/bridge/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/bridge/
cp /srv/DMRlink/template.py /opt/dmrlink/bridge/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/bridge/
#
cp /srv/DMRlink/bridge.py /opt/dmrlink/bridge/
cp /srv/DMRlink/bridge_rules_SAMPLE.py /opt/dmrlink/bridge/
cp /srv/DMRlink/known_bridges_SAMPLE.py /opt/dmrlink/bridge/
cp /srv/DMRlink/sub_acl_SAMPLE.py /opt/dmrlink/bridge/
# ConfBridge app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/template.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/confbridge/
#
cp /srv/DMRlink/confbridge.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/confbridge_rules_SAMPLE.py /opt/dmrlink/confbridge/
# Need these?
cp /srv/DMRlink/known_bridges_SAMPLE.py /opt/dmrlink/confbridge/
cp /srv/DMRlink/sub_acl_SAMPLE.py /opt/dmrlink/confbridge/
# Log app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/log/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/log/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/log/
cp /srv/DMRlink/template.py /opt/dmrlink/log/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/log/
#
cp /srv/DMRlink/log.py /opt/dmrlink/log/
# Playback (Parrot)
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/playback/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/playback/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/playback/
cp /srv/DMRlink/template.py /opt/dmrlink/playback/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/playback/
#
cp /srv/DMRlink/playback.py /opt/dmrlink/playback/
cp /srv/DMRlink/playback_config_SAMPLE.py /opt/dmrlink/playback/
# Play Group app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/play_group/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/play_group/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/play_group/
cp /srv/DMRlink/template.py /opt/dmrlink/play_group/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/play_group/
#
cp /srv/DMRlink/play_group.py /opt/dmrlink/play_group/
# record app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/record/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/record/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/record/
cp /srv/DMRlink/template.py /opt/dmrlink/record/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/record/
#
cp /srv/DMRlink/record.py /opt/dmrlink/record/
# rcm app
cp /srv/DMRlink/dmrlink.py /opt/dmrlink/rcm/
cp /srv/DMRlink/dmrlink_config.py /opt/dmrlink/rcm/
cp /srv/DMRlink/dmrlink_log.py /opt/dmrlink/rcm/
cp /srv/DMRlink/template.py /opt/dmrlink/rcm/
cp /srv/DMRlink/dmrlink_SAMPLE.cfg /opt/dmrlink/rcm/
#
cp /srv/DMRlink/rcm_db_log.py /opt/dmrlink/rcm/
cp /srv/DMRlink/rcm.py /opt/dmrlink/rcm/
cp /srv/DMRlink/pickle_stat_reader.py /opt/dmrlink/rcm/