mirror of
https://github.com/AG7GN/nexus-utilities.git
synced 2025-05-19 07:50:12 -07:00
Bug fixes to APRS script
This commit is contained in:
parent
d2620d69da
commit
cc230b694f
@ -130,8 +130,11 @@ Print Direwolf's audio statistics every x seconds. Set to 0 to disable printing
|
|||||||
|
|
||||||
<h2 id="auto">Autostart APRS</h2>
|
<h2 id="auto">Autostart APRS</h2>
|
||||||
<p>
|
<p>
|
||||||
<a href="#top">Top</a>
|
Default is disabled. If disabled, Direwolf APRS will not autostart when the Pi boots up. Otherwise, select which levers in the piano switch you want to be in the ON (down) position. A corresponding piano script will be created and, if the switches are in the selected postion, will autostart APRS at bootup. If 'none' is selected, meaning all switches are in the OFF (UP) position, script piano.sh will be created and will autostart APRS provided all levers are in the UP position.
|
||||||
Default is disabled. If disabled, Direwolf APRS will not autostart when the Pi boots up. Otherwise, select which levers in the piano switch you want to be in the ON (down) position. A corresponding piano script will be created and, if the switches are in the selected postion, will autostart APRS at bootup. If 'none' is selected, meaning all switches are in the OFF (UP) position, script piano.sh will be created and will autostart APRS provided all levers are in the UP position. See <a href="https://github.com/AG7GN/hampi-utilities/blob/master/README.md#check-piano-script">Check Piano Script</a> for details.
|
<br /><br />
|
||||||
|
<b>IMPORTANT</b>: Scripts with the same name will be overwritten without warning!
|
||||||
|
<br /><br />
|
||||||
|
See <a href="https://github.com/AG7GN/hampi-utilities/blob/master/README.md#check-piano-script">Check Piano Script</a> for details.
|
||||||
</p>
|
</p>
|
||||||
<a href="#top">Top</a>
|
<a href="#top">Top</a>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#%
|
#%
|
||||||
#================================================================
|
#================================================================
|
||||||
#- IMPLEMENTATION
|
#- IMPLEMENTATION
|
||||||
#- version ${SCRIPT_NAME} 0.1.3
|
#- version ${SCRIPT_NAME} 0.1.8
|
||||||
#- author Steve Magnuson, AG7GN
|
#- author Steve Magnuson, AG7GN
|
||||||
#- license CC-BY-SA Creative Commons License
|
#- license CC-BY-SA Creative Commons License
|
||||||
#- script_id 0
|
#- script_id 0
|
||||||
@ -280,10 +280,22 @@ $IGSERVER
|
|||||||
$FILTER
|
$FILTER
|
||||||
$IGTXVIA
|
$IGTXVIA
|
||||||
$IGTXLIMIT
|
$IGTXLIMIT
|
||||||
|
AGWPORT 0
|
||||||
|
KISSPORT 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function killDirewolf () {
|
||||||
|
if pgrep "^direwolf" >/dev/null
|
||||||
|
then
|
||||||
|
pkill "^direwolf"
|
||||||
|
echo -e "\n\nDirewolf stopped. Click \"Restart...\" button below to restart." >$PIPEDATA
|
||||||
|
else
|
||||||
|
echo -e "\n\nDirewolf was already stopped. Click \"Restart...\" button below to restart." >$PIPEDATA
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#============================
|
#============================
|
||||||
# FILES AND VARIABLES
|
# FILES AND VARIABLES
|
||||||
#============================
|
#============================
|
||||||
@ -311,7 +323,7 @@ CONFIG_FILE="$HOME/direwolf_aprs.conf"
|
|||||||
|
|
||||||
CONFIG_TAB_TEXT="<b><big><big>Direwolf APRS Configuration</big></big></b>\n \
|
CONFIG_TAB_TEXT="<b><big><big>Direwolf APRS Configuration</big></big></b>\n \
|
||||||
<span color='red'><b>DO NOT USE</b></span> the '<b>~</b>' character in any field below. \
|
<span color='red'><b>DO NOT USE</b></span> the '<b>~</b>' character in any field below. \
|
||||||
Click the <b>Restart...</b> button after you make your changes.\n"
|
Click the <b>Restart...</b> button to save your changes and restart APRS.\n"
|
||||||
|
|
||||||
ID="${RANDOM}"
|
ID="${RANDOM}"
|
||||||
|
|
||||||
@ -419,9 +431,10 @@ else # No configuration files exist
|
|||||||
FIRST_RUN=true
|
FIRST_RUN=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export -f setDefaults loadAPRSDefaults
|
export -f setDefaults loadAPRSDefaults killDirewolf
|
||||||
export load_aprs_defaults_cmd='@bash -c "setDefaults; loadAPRSDefaults"'
|
export load_aprs_defaults_cmd='@bash -c "setDefaults; loadAPRSDefaults"'
|
||||||
export click_aprs_help_cmd='bash -c "xdg-open /usr/local/share/hampi/aprs_help.html"'
|
export click_aprs_help_cmd='bash -c "xdg-open /usr/local/share/hampi/aprs_help.html"'
|
||||||
|
export PIPEDATA=$PIPE
|
||||||
|
|
||||||
#============================
|
#============================
|
||||||
# MAIN SCRIPT
|
# MAIN SCRIPT
|
||||||
@ -438,7 +451,7 @@ $SYNTAX && set -n
|
|||||||
# Run in debug mode, if set
|
# Run in debug mode, if set
|
||||||
$DEBUG && set -x
|
$DEBUG && set -x
|
||||||
|
|
||||||
while [[ $RETURN_CODE == 0 ]]
|
while true
|
||||||
do
|
do
|
||||||
YAD_PIDs=()
|
YAD_PIDs=()
|
||||||
# Kill any running processes and load latest settings
|
# Kill any running processes and load latest settings
|
||||||
@ -450,8 +463,8 @@ do
|
|||||||
rm -f $TMPDIR/CONFIGURE_APRS.txt
|
rm -f $TMPDIR/CONFIGURE_APRS.txt
|
||||||
loadSettings $CONFIG_FILE
|
loadSettings $CONFIG_FILE
|
||||||
# Start the tail window tab
|
# Start the tail window tab
|
||||||
[[ $FIRST_RUN == true ]] && MODE="" || MODE="${F[_APRSMODE_]}"
|
[[ $FIRST_RUN == true ]] && MODE_MESSAGE="" || MODE_MESSAGE="${F[_APRSMODE_]}"
|
||||||
TEXT="<big><b>Direwolf $MODE APRS Monitor</b></big>"
|
TEXT="<big><b>Direwolf $MODE_MESSAGE APRS Monitor</b></big>"
|
||||||
yad --plug="$ID" --tabnum=1 \
|
yad --plug="$ID" --tabnum=1 \
|
||||||
--back=black --fore=yellow \
|
--back=black --fore=yellow \
|
||||||
--text-info --text-align=center \
|
--text-info --text-align=center \
|
||||||
@ -459,7 +472,7 @@ do
|
|||||||
YAD_PIDs+=( $! )
|
YAD_PIDs+=( $! )
|
||||||
if [[ $FIRST_RUN == true ]]
|
if [[ $FIRST_RUN == true ]]
|
||||||
then
|
then
|
||||||
echo "Configure Direwolf APRS in the \"Configure APRS\" tab, then click \"Restart...\" button below." >&6
|
echo -e "\n\nDirewolf was not started because APRS is not configured.\nConfigure it in the \"Configure APRS\" tab, then click the \"Restart...\" button below." >&6
|
||||||
else # Not a first run. Direwolf appears to be configured so start it
|
else # Not a first run. Direwolf appears to be configured so start it
|
||||||
echo >&6
|
echo >&6
|
||||||
echo "Using Direwolf configuration in $DW_CONFIG:" >&6
|
echo "Using Direwolf configuration in $DW_CONFIG:" >&6
|
||||||
@ -467,6 +480,7 @@ do
|
|||||||
echo >&6
|
echo >&6
|
||||||
[[ ${F[_AUDIOSTATS_]} == 0 ]] || DIREWOLF+=" -a ${F[_AUDIOSTATS_]}"
|
[[ ${F[_AUDIOSTATS_]} == 0 ]] || DIREWOLF+=" -a ${F[_AUDIOSTATS_]}"
|
||||||
$DIREWOLF -c $DW_CONFIG >&6 2>&6 &
|
$DIREWOLF -c $DW_CONFIG >&6 2>&6 &
|
||||||
|
echo -e "\n\nDirewolf APRS is running." >&6
|
||||||
fi
|
fi
|
||||||
# Set up tab for configuring Direwolf.
|
# Set up tab for configuring Direwolf.
|
||||||
CMD=(
|
CMD=(
|
||||||
@ -559,14 +573,12 @@ do
|
|||||||
--buttons-layout=center \
|
--buttons-layout=center \
|
||||||
--tab="Monitor APRS" \
|
--tab="Monitor APRS" \
|
||||||
--tab="Configure APRS" \
|
--tab="Configure APRS" \
|
||||||
--button="<b>Stop Direwolf APRS and Exit</b>":1 \
|
--button="<b>Exit</b>":1 \
|
||||||
|
--button="<b>Stop Direwolf APRS</b>":'bash -c "killDirewolf"' \
|
||||||
--button="<b>Restart Direwolf APRS</b>":0
|
--button="<b>Restart Direwolf APRS</b>":0
|
||||||
RETURN_CODE=$?
|
RETURN_CODE=$?
|
||||||
|
|
||||||
case $RETURN_CODE in
|
case $RETURN_CODE in
|
||||||
1|252) # User click Exit button or closed window.
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
0) # Read and handle the Configure APRS tab yad output
|
0) # Read and handle the Configure APRS tab yad output
|
||||||
[[ -s $TMPDIR/CONFIGURE_APRS.txt ]] || Die "Unexpected input from dialog"
|
[[ -s $TMPDIR/CONFIGURE_APRS.txt ]] || Die "Unexpected input from dialog"
|
||||||
IFS='~' read -r -a TF < "$TMPDIR/CONFIGURE_APRS.txt"
|
IFS='~' read -r -a TF < "$TMPDIR/CONFIGURE_APRS.txt"
|
||||||
@ -611,7 +623,6 @@ do
|
|||||||
else
|
else
|
||||||
FIRST_RUN=false
|
FIRST_RUN=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make or update an autostart piano switch script if necessary
|
# Make or update an autostart piano switch script if necessary
|
||||||
if [[ ${F[_BOOTSTART_]} == "disabled" ]]
|
if [[ ${F[_BOOTSTART_]} == "disabled" ]]
|
||||||
then # Disable autostart
|
then # Disable autostart
|
||||||
@ -623,11 +634,14 @@ do
|
|||||||
[[ $PREVIOUS_AUTOSTART =~ none ]] && SWITCHES="" || SWITCHES="$PREVIOUS_AUTOSTART"
|
[[ $PREVIOUS_AUTOSTART =~ none ]] && SWITCHES="" || SWITCHES="$PREVIOUS_AUTOSTART"
|
||||||
rm -f $HOME/piano${SWITCHES}.sh
|
rm -f $HOME/piano${SWITCHES}.sh
|
||||||
[[ ${F[_BOOTSTART_]} =~ none ]] && SWITCHES="" || SWITCHES="${F[_BOOTSTART_]}"
|
[[ ${F[_BOOTSTART_]} =~ none ]] && SWITCHES="" || SWITCHES="${F[_BOOTSTART_]}"
|
||||||
echo -e "#!/bin/bash\n$(command -v $(basename $0)) >/dev/null 2>&1" > $HOME/piano${SWITCHES}.sh
|
echo -e "#!/bin/bash\nsleep 5\n$(command -v $(basename $0)) >/dev/null 2>&1" > $HOME/piano${SWITCHES}.sh
|
||||||
chmod +x $HOME/piano$SWITCHES.sh
|
chmod +x $HOME/piano$SWITCHES.sh
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
*) # 1, 252, or anything else. User click Exit button or closed window.
|
||||||
|
break
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
SafeExit
|
SafeExit
|
||||||
|
@ -1 +1 @@
|
|||||||
VERSION="2.2.0"
|
VERSION="2.2.1"
|
Loading…
x
Reference in New Issue
Block a user