mirror of
https://github.com/AG7GN/nexus-utilities.git
synced 2025-05-16 06:30:09 -07:00
Added README
This commit is contained in:
parent
3d355e2fc2
commit
4c79afbce0
130
README.md
130
README.md
@ -1 +1,129 @@
|
|||||||
# Hampi Utilities
|
# Hampi Utilities
|
||||||
|
|
||||||
|
This is a collection of utilities for the Hampi image. These scripts will only work on the Hampi image. Some scripts are specific to the [Nexus DR-X](http://wb7fhc.com/nexus-dr-x.html) board.
|
||||||
|
|
||||||
|
[check-piano.sh](#check-piano.sh)
|
||||||
|
|
||||||
|
[initialize-pi.sh](#initialize-pi.sh)
|
||||||
|
|
||||||
|
[name-radios.sh](#name-radios.sh)
|
||||||
|
|
||||||
|
[patmail.sh](#patmmail.sh)
|
||||||
|
|
||||||
|
[tnc-left.conf tnc-right.conf](#tnc-left.conf-tnc-right.conf)
|
||||||
|
|
||||||
|
[test-piano.sh](#test-piano.sh)
|
||||||
|
|
||||||
|
[tnc.sh](#tnc.sh)
|
||||||
|
|
||||||
|
[trim scripts](#trim-scripts)
|
||||||
|
|
||||||
|
[watchdog-tnc.sh](#watchdog-tnc.sh)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Easy Install
|
||||||
|
|
||||||
|
- Click __Raspberry > Hamradio > Update Pi and Ham Apps__.
|
||||||
|
- Check __hampi-utilities__, click __OK__.
|
||||||
|
|
||||||
|
### Manual Install
|
||||||
|
|
||||||
|
Alternatively, you can install these utilities manually as follows:
|
||||||
|
|
||||||
|
- Open a terminal and run:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
rm -rf hampi-utilities
|
||||||
|
git clone https://github.com/AG7GN/hampi-utilities
|
||||||
|
sudo cp hampi-utilities/*.sh /usr/local/bin
|
||||||
|
sudo cp hampi-utilities/*.desktop /usr/local/share/applications/
|
||||||
|
cp hampi-utilities/hampi-utilities.version /usr/local/src/hampi/
|
||||||
|
rm -rf hampi-utilities
|
||||||
|
|
||||||
|
## check-piano.sh
|
||||||
|
|
||||||
|
This script is called by [initialize-pi.sh](#initialize-pi.sh) whenever the Pi starts. It reads the position of the piano switches on the [Nexus DR-X](http://wb7fhc.com/nexus-dr-x.html) board and launches a script based on which switch levers are up or down.
|
||||||
|
|
||||||
|
The script that `check-piano.sh` calls must be in the user's home directory, be marked as executable, and be named `pianoX.sh` where X is one of these:
|
||||||
|
|
||||||
|
1, 12, 13, 14, 123, 124, 134, 1234, 2, 23, 234, 24, 3, 34, 4
|
||||||
|
|
||||||
|
Example: When the piano switch levers 2 and 4 are down, the script named `$HOME/piano24.sh` will run whenever the Raspberry Pi starts.
|
||||||
|
|
||||||
|
If a pianoX.sh script is not present, no action is taken and the pi boots normally.
|
||||||
|
|
||||||
|
## initialize-pi.sh
|
||||||
|
|
||||||
|
This script is run whenever the Pi starts. It runs via this line in user pi's crontab:
|
||||||
|
|
||||||
|
@reboot sleep 5 && /usr/local/bin/initialize-pi.sh
|
||||||
|
|
||||||
|
The script checks for the presence of a file called `DO_NOT_DELETE_THIS_FILE` in the user's home directory. If the file is present, the script runs [check-piano.sh](#check-piano.sh) and then exits.
|
||||||
|
|
||||||
|
If `DO_NOT_DELETE_THIS_FILE` is not present in the user's home directory, the script will reset various configuration files for ham radio applications to default values and reset the VNC Server and SSH keys.
|
||||||
|
|
||||||
|
## name-radios.sh
|
||||||
|
|
||||||
|
This script allows the user to change the title bar of Fldigi suite and Direwolf applications so they say something other than "Left Radio" or "Right Radio". The associated menu item file is `nameradios.desktop`.
|
||||||
|
|
||||||
|
## patmail.sh
|
||||||
|
|
||||||
|
This script allows the user to run [pat](https://getpat.io) within scripts rather than interactively. Obviously, pat must be installed for it to work. You can install Pat via __Raspberry > Hamradio > Update Pi and Ham Apps__.
|
||||||
|
|
||||||
|
## test-piano.sh
|
||||||
|
|
||||||
|
This script allows you to test the operation of your `pianoX.sh` script by simulating what the [check-piano.sh](#check-piano.sh) does when the Pi starts. Set the piano switches as desired, then open a Terminal and run `test-piano.sh`. The script will tell you which script will run based on which switch levers are down. It will not actually run the `pianoX.sh` script.
|
||||||
|
|
||||||
|
## tnc-left.conf tnc-right.conf
|
||||||
|
|
||||||
|
These configuration files are required by [/usr/local/bin/tnc.sh](#tnc.sh) script. They contain the configuration that `tnc.sh` needs in order to operate with Direwolf as an APRS Digitpeater, iGate, Digipeater+iGate, or ax25 TNC.
|
||||||
|
|
||||||
|
`tnc.sh` will look for `tnc.conf` in the user's home folder. To use `tnc.sh`, you must make a symlink to the appropriate tnc configuration file for the left or right radio.
|
||||||
|
|
||||||
|
- For the left radio:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
ln -s tnc-left.conf tnc.conf
|
||||||
|
|
||||||
|
- For the right radio:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
ln -s tnc-right.conf tnc.conf
|
||||||
|
|
||||||
|
__IMPORTANT__: You must edit tnc-{left|right}.conf with your own settings.
|
||||||
|
|
||||||
|
|
||||||
|
## tnc.sh
|
||||||
|
|
||||||
|
This is a script that launches Direwolf, and optionally other related apps, in different modes. The script will look for [tnc.conf](#tnc-left.conf-tnc-right.conf) in the user's home directory. The script will set up Direwolf to operate in any one of these modes TNC: ax25, APRS Digipeater, APRS iGate, APRS Digipeater+iGate. It can also launch pat, ardop, pat+ax25, or pat+ardop provided those apps are also installed and configured.
|
||||||
|
|
||||||
|
## trim scripts
|
||||||
|
|
||||||
|
trim-fldigi-log.sh
|
||||||
|
trim-flmsg-log.sh
|
||||||
|
trim-flrig-log.sh
|
||||||
|
trim-fsq-audit.sh
|
||||||
|
trim-fsq-heard.sh
|
||||||
|
|
||||||
|
This collection of scripts trims the logs of various applications in the Fldigi family. They all take 1 argument: A date reference, for example: "10 days ago" or "1 hour ago". The script will delete log entries older than the date specified. These scripts are run whenever you launch Fldigi, Flrig and Flmsg from the __Raspberry > Hamradio__ menu. You can change the timeframe of the trim by editing the `.desktop.` file. For example, this is the Exec entry in the `/usr/local/share/applications/fldigi-left.desktop` file:
|
||||||
|
|
||||||
|
Exec=sh -c '/usr/local/bin/trim-fldigi-log.sh "yesterday";PULSE_SINK=fepi-playback PULSE_SOURCE=fepi-capture fldigi --config-dir /home/pi/.fldigi-left -title "Fldigi (Left Radio)" --flmsg-dir /home/pi/.nbems-left'
|
||||||
|
|
||||||
|
To change it to trim log entries older than 2 weeks ago rather than yesterday, the line would look like this:
|
||||||
|
|
||||||
|
Exec=sh -c '/usr/local/bin/trim-fldigi-log.sh "2 weeks ago";PULSE_SINK=fepi-playback PULSE_SOURCE=fepi-capture fldigi --config-dir /home/pi/.fldigi-left -title "Fldigi (Left Radio)" --flmsg-dir /home/pi/.nbems-left'
|
||||||
|
|
||||||
|
## watchdog-tnc.sh
|
||||||
|
|
||||||
|
This script is run via cron. It launches tnc.sh and restarts it automatically if it stops for some reason. It is intended for use when [tnc.sh](#tnc.sh) is run in one of the APRS modes. The script takes one argument, which it passes on to tnc.sh as the "mode" argument. These are examples of entries you could use in crontab (only ONE can be used at one time):
|
||||||
|
|
||||||
|
# This one digipeats only - no internet
|
||||||
|
*/2 * * * * /usr/local/bin/watchdog-tnc.sh digi >/dev/null 2>&1
|
||||||
|
|
||||||
|
# This one digipeats and igates
|
||||||
|
*/2 * * * * /usr/local/bin/watchdog-tnc.sh digiigate >/dev/null 2>&1
|
||||||
|
|
||||||
|
# This one igates only
|
||||||
|
*/2 * * * * /usr/local/bin/watchdog-tnc.sh igate >/dev/null 2>&1
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
VERSION="1.0.4"
|
VERSION="1.1.0"
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
VERSION="1.0.3"
|
VERSION="1.0.3"
|
||||||
|
|
||||||
# This script allows the user to change the title bar of Fldigi suite and Direwolf applications so they
|
# This script allows the user to change the title bar of Fldigi suite and Direwolf
|
||||||
# say something other than "Left Radio" or "Right Radio"
|
# applications so they say something other than "Left Radio" or "Right Radio"
|
||||||
|
|
||||||
TITLE="Left/Right Radio Name Editor $VERSION"
|
TITLE="Left/Right Radio Name Editor $VERSION"
|
||||||
CONFIG_FILE="$HOME/radionames.conf"
|
CONFIG_FILE="$HOME/radionames.conf"
|
||||||
|
@ -97,7 +97,7 @@ ARDOP_PORT=8515
|
|||||||
|
|
||||||
## I haven't tested PulseAudio devices defined in PulseAudio, but they should work.
|
## I haven't tested PulseAudio devices defined in PulseAudio, but they should work.
|
||||||
## Or, to use the plughw device, run 'arecord -L' to get the device name.
|
## Or, to use the plughw device, run 'arecord -L' to get the device name.
|
||||||
ARDOP_DEV="fepi-capture-right fepi-playback-right"
|
ARDOP_DEV="fepi-capture-left fepi-playback-left"
|
||||||
#ARDOP_DEV="plughw:CARD=Audio,DEV=0 plughw:CARD=Audio,DEV=0"
|
#ARDOP_DEV="plughw:CARD=Audio,DEV=0 plughw:CARD=Audio,DEV=0"
|
||||||
|
|
||||||
## Pick ONE of the following three PTT types (GPIO, CAT, or Serical) for ARDOP:
|
## Pick ONE of the following three PTT types (GPIO, CAT, or Serical) for ARDOP:
|
||||||
|
103
tnc.sh
103
tnc.sh
@ -15,60 +15,10 @@
|
|||||||
# to keep it running.
|
# to keep it running.
|
||||||
#
|
#
|
||||||
#===========================================================================================
|
#===========================================================================================
|
||||||
VERSION="3.1.2"
|
VERSION="3.1.3"
|
||||||
|
|
||||||
# BEGINNING OF USER CONFIGURATION SECTION ########################################################
|
|
||||||
|
|
||||||
TNC_CONFIG_FILE="$HOME/tnc.conf"
|
TNC_CONFIG_FILE="$HOME/tnc.conf"
|
||||||
|
|
||||||
if [ -s "$TNC_CONFIG_FILE" ]
|
|
||||||
then
|
|
||||||
source $HOME/tnc.conf
|
|
||||||
if [[ $MYCALL =~ N0CALL || $MYCALL =~ N0ONE ]]
|
|
||||||
then
|
|
||||||
echo >&2 "Error: You must set the MYCALL variable in $TNC_CONFIG_FILE."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo >&2 "Error: Configuration file $TNC_CONFIG_FILE is missing or empty."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# END OF USER CONFIGURATION SECTION ########################################################
|
|
||||||
|
|
||||||
# Initializations ##########################################################################
|
|
||||||
|
|
||||||
# trap ctrl-c and call ctrl_c()
|
|
||||||
trap ctrl_c INT
|
|
||||||
|
|
||||||
LOGFILE="/tmp/tnc.log"
|
|
||||||
SCREENCONFIG="/tmp/tnc.sh.screenrc"
|
|
||||||
ACTION="${1,,}" # start|stop
|
|
||||||
DMODE="${2,,}" # direwolf mode: digi,igate,digi+igate,ax25
|
|
||||||
SPEED="${3,,}" # speed. No value implies 1200. Otherwise, allowed values are 300 or 9600.
|
|
||||||
AUDIO_CHANNELS="$4"
|
|
||||||
[[ $SPEED == "" ]] && SPEED="1200"
|
|
||||||
[[ $AUDIO_CHANNELS == "" ]] && AUDIO_CHANNELS="1"
|
|
||||||
declare -a ORDERS
|
|
||||||
declare -A CMDS
|
|
||||||
CMDS[direwolf]="$(which direwolf) -a $AUDIOSTATS -t $COLORS -r $ARATE"
|
|
||||||
cat > $SCREENCONFIG << EOF
|
|
||||||
logfile $LOGFILE
|
|
||||||
logfile flush 1
|
|
||||||
logtstamp on
|
|
||||||
logtstamp after 60
|
|
||||||
log on
|
|
||||||
logtstamp string "[ %n:%t ] ---- TIMESTAMP ---- %Y-%m-%d %c:%s ---- Press Ctrl-C to Quit\012"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Functions ################################################################################
|
|
||||||
|
|
||||||
function ctrl_c () {
|
|
||||||
# Do cleanup if Ctrl-C is pressed. Stop all the screens.
|
|
||||||
$0 stop
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function Usage() {
|
function Usage() {
|
||||||
echo
|
echo
|
||||||
echo "Version $VERSION"
|
echo "Version $VERSION"
|
||||||
@ -131,6 +81,57 @@ function Usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# BEGINNING OF USER CONFIGURATION SECTION ########################################################
|
||||||
|
|
||||||
|
if [ -s "$TNC_CONFIG_FILE" ]
|
||||||
|
then
|
||||||
|
source $HOME/tnc.conf
|
||||||
|
if [[ $MYCALL =~ N0CALL || $MYCALL =~ N0ONE ]]
|
||||||
|
then
|
||||||
|
echo >&2 "Error: You must set the MYCALL variable in $TNC_CONFIG_FILE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2 "Error: Configuration file $TNC_CONFIG_FILE is missing or empty."
|
||||||
|
echo Usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# END OF USER CONFIGURATION SECTION ########################################################
|
||||||
|
|
||||||
|
# Initializations ##########################################################################
|
||||||
|
|
||||||
|
# trap ctrl-c and call ctrl_c()
|
||||||
|
trap ctrl_c INT
|
||||||
|
|
||||||
|
LOGFILE="/tmp/tnc.log"
|
||||||
|
SCREENCONFIG="/tmp/tnc.sh.screenrc"
|
||||||
|
ACTION="${1,,}" # start|stop
|
||||||
|
DMODE="${2,,}" # direwolf mode: digi,igate,digi+igate,ax25
|
||||||
|
SPEED="${3,,}" # speed. No value implies 1200. Otherwise, allowed values are 300 or 9600.
|
||||||
|
AUDIO_CHANNELS="$4"
|
||||||
|
[[ $SPEED == "" ]] && SPEED="1200"
|
||||||
|
[[ $AUDIO_CHANNELS == "" ]] && AUDIO_CHANNELS="1"
|
||||||
|
declare -a ORDERS
|
||||||
|
declare -A CMDS
|
||||||
|
CMDS[direwolf]="$(which direwolf) -a $AUDIOSTATS -t $COLORS -r $ARATE"
|
||||||
|
cat > $SCREENCONFIG << EOF
|
||||||
|
logfile $LOGFILE
|
||||||
|
logfile flush 1
|
||||||
|
logtstamp on
|
||||||
|
logtstamp after 60
|
||||||
|
log on
|
||||||
|
logtstamp string "[ %n:%t ] ---- TIMESTAMP ---- %Y-%m-%d %c:%s ---- Press Ctrl-C to Quit\012"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Functions ################################################################################
|
||||||
|
|
||||||
|
function ctrl_c () {
|
||||||
|
# Do cleanup if Ctrl-C is pressed. Stop all the screens.
|
||||||
|
$0 stop
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkApp () {
|
function checkApp () {
|
||||||
APP="$(which $1)"
|
APP="$(which $1)"
|
||||||
if [[ $APP == "" ]]
|
if [[ $APP == "" ]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user