1
0
mirror of https://github.com/AG7GN/nexus-utilities.git synced 2025-05-29 12:50:14 -07:00

Add Yaesu support to install_wecg.sh

This commit is contained in:
Steve Magnuson 2021-09-10 12:48:35 -07:00
parent 756e6d37d3
commit 8f2fbb3169

View File

@ -1,6 +1,6 @@
#!/bin/bash
VERSION="1.0.4"
VERSION="1.0.5"
# 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.
@ -16,13 +16,14 @@ function Usage () {
echo "Kenwood Tm-D710G or TM-V71A radios attached via a serial cable."
echo
echo "Usage:"
echo " $(basename $0) left|right <fldigi-frequency> rmsgw|aprs <restore-frequency>"
echo " $(basename $0) left|right <fldigi-frequency> [rmsgw|aprs <restore-frequency>]"
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 " OPTIONAL:"
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"
@ -35,7 +36,7 @@ function Usage () {
}
# Check for 4 arguments arguments
[[ $# == 4 ]] || Usage
[[ $# == 2 || $# == 4 ]] || Usage
function Die () {
echo "${*}"
@ -44,9 +45,12 @@ function Die () {
# Validate input
RE="^[0-9]+([.][0-9]+)?$"
[[ $2 =~ $RE && $4 =~ $RE ]] || Die "ERROR: One or both frequencies supplied are not numbers"
[[ $2 =~ $RE ]] || "ERROR: $2 is not a frequency"
[[ ! -z $4 && $4 =~ $RE ]] || Die "ERROR: $4 is not a frequency"
FLDIGI_FREQ="$2"
RESTORE_FREQ="$4"
[[ ! -z $4 ]] && RESTORE_FREQ="$4" || RESTORE_FREQ=""
case ${1,,} in
left|right)
SIDE="${1,,}"
@ -55,14 +59,19 @@ case ${1,,} in
Die "ERROR: First argument must be left or right"
;;
esac
case ${3,,} in
if [[ ! -z $3 ]]
then
case ${3,,} in
rmsgw|aprs)
RESTORE_APP="${3,,}"
;;
*)
Die "ERROR: First argument must be left or right"
Die "ERROR: Third argument must be left or right"
;;
esac
esac
else
RESTORE_APP=""
fi
# Get the files
echo >&2 "Retrieving WECG files and scripts..."
@ -83,12 +92,17 @@ echo >&2 "Done."
echo >&2 "Moving files into place..."
mv TM-D710G.xml $HOME/.fldigi/rigs/
sudo mv *.sh /usr/local/bin/
[[ -z $RESTORE_APP ]] && SIDE=""
for K in start stop kill
do
cp flapps_$K.template flapps_$K.desktop
[[ $K == "stop" && -z $RESTORE_APP ]] && SIDE=""
sed -i -e "s/_HOME_/\/home\/$USER/g" -e "s/_SIDE_/$SIDE/g" \
-e "s/_FLDIGI_FREQ_/$FLDIGI_FREQ/g" -e "s/_RESTORE_APP_/$RESTORE_APP/g" \
-e "s/_FLDIGI_FREQ_/$FLDIGI_FREQ/g" \
-e "s/_RESTORE_APP_/$RESTORE_APP/g" \
-e "s/_RESTORE_FREQ_/$RESTORE_FREQ/g" flapps_$K.desktop
if
fi
done
sudo mv *.desktop /usr/local/share/applications/
echo >&2 "Done."