#!/bin/bash #Pat Menu #20200427 KM4ACK #side note: written during covid-19 outbreak of 2020 export MYPATH=$HOME/patmenu2 LOGO=$MYPATH/pmlogo.png MAIN=$MYPATH/./patmenu VERSION=$(cat $MYPATH/changelog | grep release | head -1 | sed 's/release=//') source $MYPATH/config #verify pat is at least v0.12.0 PAT_VER=`pat version | awk '{print $2}' | awk -F "." '{print $2}'` 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="|" \ --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 #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="|" \ --text="${WARNMSG}" \ --button=gtk-ok touch /run/user/$UID/patwarn.txt fi #verify call is set if [ "$MYCALLSIGN" = "N0CALL" ]; then yad --title="N0CALL" --width=400 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \ --center --form --text="\r\r\r\rCall sign not set! \rGo to Settings, then Current Config Settings\rand update your call sign" \ --button=gtk-ok fi #get name of current config file source $MYPATH/.currentconf CONFIG=$(echo $CONF | sed 's/.config//') if [ -z $CONFIG ]; then CONFIG=default fi ######################## #get sudo pw ######################## if [ ! -f /run/user/$UID/.patmenu ]; then PW=$(yad --title="sudo password" --width=400 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \ --center --form --text="Please enter your sudo password" \ --field="Password":H \ --button=gtk-ok) PASS=$(echo $PW | awk -F "|" '{print $1}') echo $PASS | base64 > /run/user/$UID/.patmenu echo '#!/bin/bash' > /run/user/$UID/.pmpw echo 'PASS=$(base64 -d /run/user/$UID/.patmenu)' >> /run/user/$UID/.pmpw echo 'echo $PASS' >> /run/user/$UID/.pmpw chmod +x /run/user/$UID/.pmpw export SUDO_ASKPASS=/run/user/$UID/.pmpw #reset sudo timer to prevent false positive sudo -k echo "Checking SUDO credentials....standby" sudo -A touch /run/user/$UID/sutest 2>&1