diff --git a/getardoplist b/getardoplist index 8700446..6d63afa 100755 --- a/getardoplist +++ b/getardoplist @@ -52,8 +52,8 @@ VARATWENTY=$MYVARA'20mvaralist.txt' VARATHIRTY=$MYVARA'30mvaralist.txt' VARAFM=$MYVARA'varafm.txt' -GRID=$(grep locator $XDG_CONFIG_HOME/pat/config.json | sed 's/"locator"://;s/"//g;s/,//;s/ //g') -echo "GRID=$GRID" > $HOME/patmenu2/.grid +GRID=$(jq -r .locator "$XDG_CONFIG_HOME"/pat/config.json) +echo "GRID=$GRID" > "$HOME/patmenu2/.grid" #check internet connection echo "Please wait while we check your internet connection" diff --git a/patmenu b/patmenu index c917841..a446bd1 100755 --- a/patmenu +++ b/patmenu @@ -4,30 +4,34 @@ #20200427 KM4ACK #side note: written during covid-19 outbreak of 2020 +# some OS don't set this var +if [ -z "$XDG_CONFIG_HOME" ]; then + export XDG_CONFIG_HOME="$HOME/.config" +fi export MYPATH=$HOME/patmenu2 -LOGO=$MYPATH/pmlogo.png -MAIN=$MYPATH/./patmenu -VERSION=$(cat $MYPATH/changelog | grep release | head -1 | sed 's/release=//') +LOGO="$MYPATH/pmlogo.png" +MAIN="$MYPATH/./patmenu" +VERSION="$(grep release "$MYPATH"/changelog | head -1 | sed 's/release=//')" -source $MYPATH/config +source "$MYPATH/config" #verify pat is at least v0.12.0 -PAT_VER=`pat version | awk '{print $2}' | awk -F "." '{print $2}'` +PAT_VER=$(pat version | awk '{print $2}' | awk -F "." '{print $2}') -if [ $PAT_VER -lt 12 ]; then +if [ "$PAT_VER" -lt 12 ]; then #give user notice yad --form --width=420 --text-align=center --center --title="Pat out of Date" --text-align=center \ ---image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ +--image "$LOGO" --window-icon="$LOGO" --image-on-top --separator="|" --item-separator="|" \ --text="Pat Menu only supports Pat Winlink\rversion 0.12.0 or later\rPlease update Pat Winlink" \ --button=gtk-ok exit fi -if [ $WARN = 'yes' ] && [ ! -f /run/user/$UID/patwarn.txt ]; then +if [[ $WARN = 'yes' ]] && [[ ! -f /run/user/$UID/patwarn.txt ]]; then #give user warning message yad --form --width=420 --text-align=center --center --title="WARNING!!" --text-align=center \ ---image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ +--image "$LOGO" --window-icon="$LOGO" --image-on-top --separator="|" --item-separator="|" \ --text="${WARNMSG}" \ --button=gtk-ok touch /run/user/$UID/patwarn.txt @@ -42,15 +46,15 @@ yad --title="N0CALL" --width=400 --height=100 \ fi #get name of current config file -source $MYPATH/.currentconf -CONFIG=$(echo $CONF | sed 's/.config//') -CURRENT_GRID=$(grep locator $XDG_CONFIG_HOME/pat/config.json | sed 's/"locator": "//;s/ //g;s/",//') -if [ -z $CONFIG ]; then +source "$MYPATH/.currentconf" +CONFIG=$(echo "$CONF" | sed 's/.config//') +CURRENT_GRID="$(grep locator "$XDG_CONFIG_HOME"/pat/config.json | sed 's/"locator": "//;s/ //g;s/",//')" +if [ -z "$CONFIG" ]; then CONFIG=default fi yad --form --width=420 --text-align=center --center --title="Pat Menu" --text-align=center \ ---image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ +--image "$LOGO" --window-icon="$LOGO" --image-on-top --separator="|" --item-separator="|" \ --text="Pat Menu by KM4ACK\rv$VERSION" \ --field="Start/Stop Modem":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/modems"' \ --field="Find Winlink Gateways":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/find2"' \ diff --git a/setup b/setup index d22326a..1478203 100644 --- a/setup +++ b/setup @@ -16,6 +16,9 @@ fi if ! hash jq 2>/dev/null; then sudo apt install -y jq fi +if ! hash wwl 2>/dev/null; then + sudo apt install -y wwl +fi if [ -f $HOME/patmenu/config ]; then #get patmenu config file and copy to patmenu2 @@ -54,7 +57,3 @@ sudo cp /run/user/$UID/patmenu.desktop /usr/share/applications/patmenu.desktop #download RMS List $MYPATH/getardoplist - -#remove this script -rm $MYPATH/setup -