mirror of
https://gitlab.com/amrron/setup-scripts.git
synced 2026-10-17 01:54:00 -04:00
Pull image icon locally instead of from the web each time.
This commit is contained in:
+24
-9
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
################################################################################
|
||||
################# AmRRON PAT Setup and Alias Manager v0.5.1 ##################
|
||||
################# AmRRON PAT Setup and Alias Manager v0.5.2 ##################
|
||||
################# Created by TB-14 ##################
|
||||
################# 23 Feb 2019 ##################
|
||||
################# 20 Dec 2019 ##################
|
||||
################################################################################
|
||||
################################################################################
|
||||
|
||||
@@ -25,6 +25,21 @@ r="--height=${rows}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Determine location user is running script from.
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
# While $SOURCE is a symlink, resolve it
|
||||
while [ -h "$SOURCE" ]; do
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$( readlink "$SOURCE" )"
|
||||
# If $SOURCE was a relative symlink (so no "/" as prefix, need to
|
||||
#resolve it relative to the symlink base directory
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
#echo "$DIR"
|
||||
|
||||
|
||||
function dep_check() {
|
||||
|
||||
|
||||
@@ -40,7 +55,7 @@ fi
|
||||
if ! hash pat 2>/dev/null; then
|
||||
echo "Pat is not installed. Please install pat and try again.
|
||||
|
||||
https://getpat.io" | yad --center --text-info --wrap --image=/tmp/banner.png --show-uri --button="Exit:1" --title "Install PAT" ${r} ${c} || exit 1
|
||||
https://getpat.io" | yad --center --text-info --wrap --image=$DIR/images/corps-icon.png --show-uri --button="Exit:1" --title "Install PAT" ${r} ${c} || exit 1
|
||||
fi
|
||||
|
||||
if ! hash getardoplist 2>/dev/null; then
|
||||
@@ -60,7 +75,7 @@ fi
|
||||
}
|
||||
|
||||
#Lets grab the AmRRON Banner.
|
||||
wget -N http://s9756.storage.proboards.com/5619756/a/KWTGc2YscxSclVEeB5jD.png -O /tmp/banner.png
|
||||
#wget -N http://s9756.storage.proboards.com/5619756/a/KWTGc2YscxSclVEeB5jD.png -O /tmp/banner.png
|
||||
|
||||
|
||||
#create a finish trap
|
||||
@@ -115,7 +130,7 @@ if ( [[ "$(jq .mycall $PATCONFIG | tr -d \")" != "" ]] && [[ "$(jq .locator $PAT
|
||||
function main_menu() {
|
||||
if [[ ! -f $PATCONFIG ]]; then
|
||||
pat configure | sleep 2 | kill $(pidof pat) ||
|
||||
{ echo "No config.json file exists. Please run 'pat configure' from a terminal and then CTRL-X to close the file. This will generate a blank file which this tool will assist you wil."; exit 1; }
|
||||
{ echo "No config.json file exists. Please run 'pat configure' from a terminal and then CTRL-X to close the file. This will generate a blank file which this tool will assist you with."; exit 1; }
|
||||
fi
|
||||
|
||||
CURRENTCALL=$(jq ".mycall" $PATCONFIG | tr -d \")
|
||||
@@ -126,7 +141,7 @@ CURRENTRIG=$(jq ".ardop.rig" $PATCONFIG | tr -d \")
|
||||
|
||||
PATSETUP=$(yad --center --wrap --title="PAT Setup and Alias Manager" \
|
||||
--text="--Please ensure you have a valid winlink account and password established.\n--The raspberry pi sometimes has problems understanding 'localhost.' Use 127.0.0.1 Using 0.0.0.0 will allow you to access the PAT UI from your local network.\n--Point your browser to the local ip and port. Example: 192.168.1.15:8080" \
|
||||
--image=/tmp/banner.png \
|
||||
--image=$DIR/images/corps-icon.png \
|
||||
--form --separator="," --item-separator="," \
|
||||
--field="Enter your callsign" "$CURRENTCALL" \
|
||||
--field="Enter your winlink password:H" "$CURRENTPASS" \
|
||||
@@ -231,7 +246,7 @@ fi
|
||||
FINDALIAS=$(yad --center --wrap --show-uri \
|
||||
--title="PAT Setup and Alias Manager" \
|
||||
--text="$LASTUPDATE\n\nSelect PAT Setup to open user and radio config.\nSelect MANAGE to view or remove current aliases.\nSelect Update to Re-Download the list of stations\nThis may take a couple minutes.\nUpdates will be visable from the PAT UI after restarting the pat http server." \
|
||||
--image=/tmp/banner.png \
|
||||
--image=$DIR/images/corps-icon.png \
|
||||
--button="PAT Setup:3" \
|
||||
--button="MANAGE:4" \
|
||||
--button="UPDATE:2" \
|
||||
@@ -261,7 +276,7 @@ TUNEMODE=$(echo $FINDALIAS | awk -F "," '{print $4}' | awk '{print $1}')
|
||||
cat $LISTLOC/${BAND}ardoplist.txt | awk '$2 ~/'${GRID}'/{print $1,$2,$3,$4,$7,$11}' | sed 's/^/false /' | tr ' ' '\012' > /tmp/stationlist
|
||||
|
||||
|
||||
cat /tmp/stationlist | yad --image=/tmp/banner.png --center \
|
||||
cat /tmp/stationlist | yad --image=$DIR/images/corps-icon.png --center \
|
||||
--checklist \
|
||||
--separator="," \
|
||||
--title "ARDOP Stations" \
|
||||
@@ -317,7 +332,7 @@ jq .connect_aliases $PATCONFIG | sed '/^}/d' | sed '/^{/d' | sed 's/^ *//g' | se
|
||||
|
||||
|
||||
|
||||
CURRENT=$(cat /tmp/currentaliases | yad --image=/tmp/banner.png --center --checklist --separator="," --title "Current Aliases" --text "Select any aliases you would like to remove" --list --print-column=2 --button="Exit:1" --button="Return:2" --button="Apply:0" --column="Saved Alias" --column="Name-Dist-Freq" --column="Alias" ${r} ${c} > /tmp/removealiases)
|
||||
CURRENT=$(cat /tmp/currentaliases | yad --image=$DIR/images/corps-icon.png --center --checklist --separator="," --title "Current Aliases" --text "Select any aliases you would like to remove" --list --print-column=2 --button="Exit:1" --button="Return:2" --button="Apply:0" --column="Saved Alias" --column="Name-Dist-Freq" --column="Alias" ${r} ${c} > /tmp/removealiases)
|
||||
|
||||
rc=$?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user