diff --git a/hampi-utilities.version b/hampi-utilities.version index 824d4c0..a2036e4 100644 --- a/hampi-utilities.version +++ b/hampi-utilities.version @@ -1 +1 @@ -VERSION="2.3.11" \ No newline at end of file +VERSION="2.3.12" \ No newline at end of file diff --git a/install_wecg.sh b/install_wecg.sh new file mode 100644 index 0000000..036bda6 --- /dev/null +++ b/install_wecg.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +VERSION="1.0.0" + +# This script installs the scripts and desktop files that customize a Nexus DR-X +# Raspberry Pi so it can be used for remote access by WECG members. +# + +function Usage () { + + echo "$(basename $0) installs scripts and files to make a Nexus DR-X Pi suitable" + echo "for remote access by WECG members. Only WECG administrators should use this" + echo "script on Pis that are designated for use by WECG members and that have" + echo "Kenwood Tm-D710G or TM-V71A radios attached via a serial cable." + echo + echo "Usage:" + echo " $(basename $0) left|right rmsgw|aprs " + echo + echo " \"left\" or \"right\" is what channel on the Nexus DR-X is used for audio" + echo " to/from the Kenwood radio." + echo + echo " \"fldigi-frequency\" is the frequency in MHz to QSY to when starting Fldigi." + echo + echo " \"rmsgw\" or \"aprs\" is what app to restart after Fldigi closes." + echo + echo " \"restore-frequency\" is the frequency in MHz to QSY to after stopping" + echo " Fldigi and restarting rmsgw or aprs." + echo + echo "Examples:" + echo " $(basename $0) left 145.580 rmsgw 144.990" + echo " $(basename $0) right 145.020 aprs 144.390" + echo +} + +# Check for 4 arguments arguments +[[ $# == 4 ]] || Usage + +function Die () { + echo "${*}" + exit 1 +} + +# Validate input +RE="^[0-9]+([.][0-9]+)?$" +[[ $2 =~ $RE && $4 =~ $RE ]] || Die "One or both frequencies supplied are not numbers" +FLDIGI_FREQ="$2" +RESTORE_FREQ="$4" +case ${1,,} in + left|right) + SIDE="${1,,}" + ;; + *) + Die "First argument must be left or right" + ;; +esac +case ${3,,} in + rmsgw|aprs) + RESTORE_APP="${3,,}" + ;; + *) + Die "First argument must be left or right" + ;; +esac + +# Get the files +echo >&2 "Retrieving WECG files and scripts..." +cd /usr/local/src/hampi +rm -rf wecg +git clone https://github.com/AG7GN/wecg +[[ $? == 0 ]] || Die "FAILED. Aborting installation." +echo >&2 "Done." +cd wecg + +# Get the Fldigi XML file for the Kenwood 710/71A +echo >&2 "Retrieving Fldigi XML file for Kenwood 710/71A..." +wget -q -O TM-D710G.xml http://www.w1hkj.com/files/xmls/kenwood/TM-D710G.xml +[[ $? == 0 ]] || Die "FAILED. Unable to retrieve FLdigi XML file." +echo >&2 "Done." + +# Move files into place +echo >&2 "Moving files into place..." +mv TM-D710G.xml $HOME/.fldigi/rigs/ +sudo mv *.sh /usr/local/bin/ +for K in start stop kill +do + sed -e "s/_HOME_/$HOME/g" -e "s/_SIDE_/$SIDE/g" \ + -e "s/_FLDIGI_FREQ_/$FLDIGI_FREQ/g" -e "s/_RESTORE_APP_/$RESTORE_APP/g" \ + -e "s/_RESTORE_FREQ_/$RESTORE_FREQ/g" flapps_$K.template > flapps_$K.desktop +done +sudo mv *.desktop /usr/local/share/applications/ +echo >&2 "Done." +echo >&2 +echo >&2 "Installation complete. Opening browser to online instructions for next step." +xdg-open https://github.com/AG7GN/wecg/readme.md & +exit 0 +