MYPATH=$HOME/patmenu2 MAIN=$MYPATH/./manage-pat LOGO=$MYPATH/pmlogo.png DELETEALIAS(){ PATCONFIG=$XDG_CONFIG_HOME/pat/config.json OUTFILE=/run/user/$UID/currentlist.txt TEMP=/run/user/$UID/patconfig.txt WHO=$(whoami) jq .connect_aliases $PATCONFIG | sed '/^}/d' | sed '/^{/d' | sed 's/^ *//g' > $OUTFILE cat $OUTFILE sed -i 's/"//g' $OUTFILE sed -i 's/,//g' $OUTFILE sed -i 's/://' $OUTFILE echo;echo cat $OUTFILE | awk 'OFS="\n" {print $1, $2}' REMOVE=$(PARSER='OFS="\n" {print $1, $2}' tail -50 $OUTFILE | awk "$PARSER" | \ yad --title="Current Alias List" --width=1100 --height=500 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --list --text="Select Alias to Delete" \ --column Call --column INFO \ --button="Delete Alias":2 \ --button="Cancel":1) BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 252 ]; then exit fi RCALL=$(echo $REMOVE | awk -F "|" '{print $1}') RCALL1=$(echo "\"$RCALL\"") #check something was selected if [ -z "$RCALL" ]; then yad --title="No Selection" --width=300 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --form --text="No station was selected\r Please try again" \ --button=gtk-ok $MAIN & exit fi jq 'del(.connect_aliases.'$RCALL1')' $PATCONFIG > $TEMP cp $TEMP $PATCONFIG rm $TEMP $OUTFILE sudo killall pat sudo systemctl start pat@$WHO yad --title="Alias Deleted" --width=400 --height=200 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --text="$RCALL1 Alias DELETED" \ --button=gtk-ok $MAIN & exit } LOGIN(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json WHO=$(whoami) CURRENT_USER=$(grep mycall $CONFIG | head -1 | sed 's/"mycall": "//;s/ //g;s/",//') USER=$(yad --form --width=420 --text-align=center --center --title="Pat Log In/Out" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Pat Log In/Out by KM4ACK" \ --field="Call Sign" "" \ --field="Winlink Password" "" \ --field="Six Character Grid Square" "EM65TV" \ --field="Current User Logged In ---- $CURRENT_USER":LBL \ --button="Log In":2 \ --button="Log Out":3 \ --button="Cancel":1) BUT=$? if [ $BUT = 252 ]; then exit elif [ $BUT = 1 ]; then $MAIN elif [ $BUT = 2 ]; then echo "Log IN" CALLSIGN=$(echo $USER | awk -F "|" '{print $1}') CALLSIGN=$(echo "${CALLSIGN^^}") PASS=$(echo $USER | awk -F "|" '{print $2}') GRID=$(echo $USER | awk -F "|" '{print $3}') GRID=$(echo "${GRID^^}") echo "$CALLSIGN $PASS $GRID" #set callsign sed -i "s/\"mycall\": \".*\",/\"mycall\": \"$CALLSIGN\",/" $CONFIG #set password sed -i "s/\"secure_login_password\": \".*\",/\"secure_login_password\": \"$PASS\",/" $CONFIG #set locator sed -i "s/\"locator\": \".*\",/\"locator\": \"$GRID\",/" $CONFIG sudo systemctl restart pat@$WHO $MAIN & exit elif [ $BUT = 3 ]; then echo "Log OUT" CALLSIGN=N0CALL PASS="" GRID="" #set callsign sed -i "s/\"mycall\": \".*\",/\"mycall\": \"$CALLSIGN\",/" $CONFIG #set password sed -i "s/\"secure_login_password\": \".*\",/\"secure_login_password\": \"$PASS\",/" $CONFIG #set locator sed -i "s/\"locator\": \".*\",/\"locator\": \"$GRID\",/" $CONFIG sudo killall pat $MAIN & exit fi } GPSGRID(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json RUBY_INSTALLED=$(which ruby) if [ -z "$RUBY_INSTALLED" ]; then yad --form --width=300 --text-align=center --center --title="Ruby not Found" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Ruby is needed to read GPS data but not found installed on your system. Would you like to install it now?" \ --button="Install Ruby":2 \ --button="Cancel":1 BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 2 ]; then INSTALLRUBY(){ sudo apt-get update sudo apt-get install -y ruby2.5 sudo gem install gpsd_client sudo gem install maidenhead } INSTALLRUBY | yad --center --progress --pulsate --auto-close --no-buttons --text-align=center \ --text="Installing Ruby. This will take several minutes\rDO NOT CLOSE THIS WINDOW\rDoing so will abort the install." fi fi yad --center --timeout=5 --timeout-indicator=top \ --auto-close --no-buttons --text="Getting grid from GPS" & NEWGRID=$($MYPATH/getgrid | cut -b 1-6) if [ "$NEWGRID" = 'JJ00aa' ]; then NEWGRID="GPS READ ERROR or NO LOCK" yad --form --width=400 --text-align=center --center --title="GPS ERROR" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Update Pat Grid by KM4ACK\r\rGPS ERROR" \ --field="Grid read from GPS":RO "$NEWGRID" \ --button=gtk-quit $MAIN & exit fi yad --form --width=200 --text-align=center --center --title="Update Grid" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Update Pat Grid by KM4ACK" \ --field="Grid read from GPS":RO "$NEWGRID" \ --button="Update Pat":2 \ --button="Cancel":1 BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 2 ]; then sed -i "s/\"locator\": \".*\",/\"locator\": \"$NEWGRID\",/" $CONFIG yad --center --timeout=2 --timeout-indicator=top \ --auto-close --no-buttons --text="Grid Square Updated" $MAIN & exit fi } RESTORECONFIG(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json OUTFILE=/run/user/$UID/config.list WHO=$(whoami) ls $XDG_CONFIG_HOME/pat/ | grep .bkup > $OUTFILE INFO=$(PARSER='OFS="\n" {print $1}' tail -10 $OUTFILE | awk "$PARSER" | \ yad --title="Restore Config" --width=1100 --height=500 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --list --text="Choose File to Restore" \ --column File-to-Restore \ --button="Cancel":1 \ --button="Restore File":2) BUT=$? if [ $BUT = 252 ]; then exit elif [ $BUT = 1 ]; then $MAIN exit fi FILE=$(echo $INFO | awk -F "|" '{print $1}') cp $XDG_CONFIG_HOME/pat/$FILE $CONFIG sudo killall pat sudo systemctl start pat@$WHO yad --form --width=420 --text-align=center --center --title="Config Restore" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Config Restore by KM4ACK\r\rRESTROE COMPLETE" \ --button=gtk-ok $MAIN } BKUPCONFIG(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json WHO=$(whoami) DATE=$(date +%d%b%Y-%H%M) yad --form --width=420 --text-align=center --center --title="Backup Config" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Backup Pat Config by KM4ACK" \ --button="Backup Config":2 \ --button="Main Menu":1 BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 252 ]; then exit elif [ $BUT = 2 ]; then echo "Backing up file" BKUPCONFIG=config.$DATE.bkup cp $CONFIG $XDG_CONFIG_HOME/pat/$BKUPCONFIG yad --form --width=420 --text-align=center --center --title="Config Backup" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Config File Backup by KM4ACK\r\rBackup COMPLETE" \ --button=gtk-ok fi $MAIN } SPEED(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json CURRENT=$(cat $CONFIG | grep -i max | sed 's/"Max":\ //' | tr -d "[:blank:]") WHO=$(whoami) NEW=$(yad --form --width=320 --text-align=center --center --title="Speed" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Current ARDOP Speed is $CURRENT" \ --field="Set ARDOP Speed to":CB "200|500|1000|2000" \ --button="Cancel":1 \ --button="Set Speed":2) BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 252 ]; then exit fi NEW=$(echo $NEW | awk -F "|" '{print $1}') sed -i "s/\"Max\":.*/ \"Max\": $NEW/" $CONFIG sudo killall pat sudo systemctl start pat@$WHO yad --form --width=320 --text-align=center --center --title="Speed" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="ARDOP Speed set to $NEW" \ --button=gtk-ok $MAIN & exit } SETPTT(){ CONFIG=$XDG_CONFIG_HOME/pat/config.json WHO=$(whoami) CURRENT=$(cat $CONFIG | grep ptt_ctrl | tail -1 | sed 's/"ptt_ctrl":\ //' | sed 's/,//' | tr -d "[:blank:]") if [ $CURRENT = 'false' ]; then CURRENT1="false|true" elif [ $CURRENT = 'true' ]; then CURRENT1="true|false" fi PTT=$(yad --form --width=400 --text="Current Pat ARDOP PTT = $CURRENT" --text-align=center --center --title="Set PTT" --text-align=center \ --separator="|" --item-separator="|" \ --image=$LOGO --window-icon=$LOGO --image-on-top \ --field="ARDOP PTT":CB "$CURRENT1" \ --button="Set PTT":2 \ --button="Cancel":1) QUIT=$? if [ $QUIT = 1 ]; then $MAIN & exit elif [ $QUIT = 252 ]; then exit fi ANS=$(echo $PTT | awk -F "|" '{print $1}') CURRENT=$(cat $CONFIG | grep ptt_ctrl | tail -1 | sed 's/"ptt_ctrl":\ //' | sed 's/,//') echo "Set $CURRENT to $ANS" if [ $CURRENT = 'false' ]; then sed -i "s/\"ptt_ctrl\":\ false,/\"ptt_ctrl\":\ $ANS,/" $CONFIG elif [ $CURRENT = 'true' ]; then sed -i "s/\"ptt_ctrl\":\ true,/\"ptt_ctrl\":\ $ANS,/" $CONFIG fi sudo killall pat sudo systemctl start pat@$WHO yad --form --width=400 --text-align=center --center --title="Set PTT" --text-align=center \ --separator="|" --item-separator="|" \ --image=$LOGO --window-icon=$LOGO --image-on-top \ --text="Pat ARDOP PTT now set to $ANS" \ --button=gtk-ok $MAIN & exit } MANUALGPS() { WHO=$(whoami) CONFIG=$XDG_CONFIG_HOME/pat/config.json CURRENT_GRID=$(grep locator $CONFIG | sed 's/"locator": "//;s/ //g;s/",//') GRID=$(yad --form --width=400 --text-align=center --center --title="Set Grid" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Update Pat Grid by KM4ACK" \ --field="Six Character Grid": "$NEWGRID" \ --field="Current Grid -------- $CURRENT_GRID":LBL \ --button="Update Grid":2 \ --button="Cancel":1) BUT=$? if [ $BUT = 252 ]; then exit fi if [ $BUT = 1 ]; then $MAIN & exit fi NEWGRID=$(echo $GRID | awk -F "|" '{print $1}') NEWGRID=${NEWGRID^^} sed -i "s/\"locator\": \".*\",/\"locator\": \"$NEWGRID\",/" $CONFIG echo "GRID UPDATED" sudo killall pat sudo systemctl start pat@$WHO yad --form --width=400 --text-align=center --center --title="Grid Update" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Grid Updated to $NEWGRID" \ --button=gtk-ok $MAIN } LISTEN(){ #This funtion sets the listen modes for Pat Winlink WHO=$(whoami) TEMP=/run/user/$UID/listen.txt NOW=$(grep ExecStart /lib/systemd/system/pat@.service | sed 's|ExecStart=/usr/bin/pat -l||;s/http//') if [ $NOW = 'ExecStart=/usr/bin/pat' ]; then NOW="Not listening for incoming connections" fi LISTEN=$(yad --center --list --checklist --width=600 --height=300 --separator="|" \ --image $LOGO --column=Check --column=Mode --column=Description \ --print-column=2 --window-icon=$LOGO --image-on-top --text-align=center \ --text="Pat Listen Modes\rCurrently Listening on:\r$NOW" --title="Pat Menu" \ false "TELNET" "Connection over Internet or Mesh" \ false "AX25" "Packet Connections 2M-440" \ false "ARDOP" "HF Connections using ARDOP Modem" \ --button="Main Menu":1 \ --button="Set Listen Mode":2 \ --button="Stop Listening":3) BUT=$? if [ $BUT = 252 ]; then exit elif [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 2 ]; then #Send results to temp file. echo $LISTEN > $TEMP #check temp file for what's there TELNET=$(grep TELNET $TEMP) ARDOP=$(grep ARDOP $TEMP) AX25=$(grep AX25 $TEMP) #Set telnet variable if [ -n "$TELNET" ]; then TELNET="telnet," fi #set ardop variable if [ -n "$ARDOP" ]; then ARDOP="ardop," fi #set ax25 variable if [ -n "$AX25" ]; then AX25="ax25," fi cat < $TEMP [Unit] Description=pat - Winlink client for %I Documentation=https://github.com/la5nta/pat/wiki After=ax25.service network.target [Service] User=%i ExecStart=/usr/bin/pat http Restart=on-failure [Install] WantedBy=multi-user.target EOF #add listen modes set by user sed -i "s|Exec.*|ExecStart=/usr/bin/pat -l $TELNET$ARDOP$AX25 http|" $TEMP sudo cp $TEMP /lib/systemd/system/pat@.service sudo systemctl daemon-reload sudo systemctl restart pat@$WHO yad --form --width=320 --text-align=center --center --title="Listening" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Listen mode set to $TELNET$ARDOP$AX25" \ --button=gtk-ok $MAIN & exit elif [ $BUT = 3 ]; then cat < $TEMP [Unit] Description=pat - Winlink client for %I Documentation=https://github.com/la5nta/pat/wiki After=ax25.service network.target [Service] User=%i ExecStart=/usr/bin/pat http Restart=on-failure [Install] WantedBy=multi-user.target EOF sudo cp $TEMP /lib/systemd/system/pat@.service sudo systemctl daemon-reload sudo systemctl restart pat@$WHO fi yad --form --width=320 --text-align=center --center --title="Listening" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="No longer listening for incoming connections" \ --button=gtk-ok $MAIN & exit } REPAIRCONFIG(){ DIR=/run/user/$UID WHO=$(whoami) FILECHECK=$(ls $DIR | grep config.json) if [ ! -z $FILECHECK ]; then rm $DIR/config.json* fi #Verify Pat installed and set path variable if it is if ! hash pat 2>/dev/null; then echo "Pat Winlink not found on this system" exit else PATV=$(pat version | awk '{print $2}' | sed 's/v0.//' | awk -F "." '{print $1}') if [ $PATV -le 11 ]; then PATPATH=$HOME/.wl2k/ else PATPATH=$XDG_CONFIG_HOME/pat/ fi fi #user input SETTINGS=$(yad --form --width=600 --text-align=center --center --title="Repair Config File" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Pat Menu\rConfig File Repair\r by KM4ACK" \ --field="Call Sign" "" \ --field="Winlink Password" "" \ --field="Six Character Grid Square" "" \ --field="Allow access to Pat across network?":CB "YES|NO" \ --button="Repair Config File":2 \ --button="Cancel":1) BUT=$? if [ $BUT = 1 ]; then $MAIN elif [ $BUT = 252 ]; then exit fi #parse input into variables CALL=$(echo $SETTINGS | awk -F "|" '{print $1}') CALL=${CALL^^} PASSWD=$(echo $SETTINGS | awk -F "|" '{print $2}') GRID=$(echo $SETTINGS | awk -F "|" '{print $3}') GRID=${GRID^^} SECURE=$(echo $SETTINGS | awk -F "|" '{print $4}') if [ "$SECURE" = 'NO' ]; then SECURE="127.0.0.1" else SECURE="0.0.0.0" fi #check to see if EES is installed and set port accordingly if [ -f /var/www/html/celladdy.php ]; then PORT=5000 else PORT=8080 fi #download config.json file from km4ack github cd $DIR wget -q https://raw.githubusercontent.com/km4ack/pi-scripts/master/config.json #verify download success if [ $? != 0 ]; then yad --title="Cannot Download!" --width=300 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --text="Cannot download new config file.\rCheck internet connection" \ --button=gtk-ok $MAIN & exit fi #update file with user settings sed -i "s/N0CALL/$CALL/" $DIR/config.json sed -i "s/PASSWORD/$PASSWD/" $DIR/config.json sed -i "s/GRID/$GRID/" $DIR/config.json sed -i "s/8080/$PORT/" $DIR/config.json sed -i "s/127.0.0.1/$SECURE/" $DIR/config.json #cp file and restart pat cp $DIR/config.json $PATPATH/ sudo systemctl restart pat@$WHO yad --title="Repair Complete" --width=300 --height=100 \ --image $LOGO --window-icon=$LOGO --image-on-top \ --center --text="Config File Repaired" \ --button=gtk-ok $MAIN & exit } PEER(){ TEMP_DIR=/run/user/$UID CONFIG=$XDG_CONFIG_HOME/pat/config.json TEMP_CONFIG=$TEMP_DIR/temp-config.txt WHO=`whoami` #get data from user PEER=$(yad --center --wrap --width=450 --title="Add P2P Alias" --text-align=center \ --text="Enter the Peer to Peer Details Below\rIf using a hostname, add \".local\" to the end.\rExample: raspberrypi.local" \ --image $LOGO --window-icon=$LOGO --image-on-top \ --button="Update:2" \ --button="Cancel:1" \ --form --separator="|" --item-separator="|" \ --field="Call Sign of Remote Station" \ --field="IP address OR hostname of Remote Station" \ ) BUT=$? if [ $BUT = 1 ]; then $MAIN & exit elif [ $BUT = 252 ]; then exit elif [ $BUT = 2 ]; then #parse info entered above REMOTE_CALL=$(echo $PEER | awk -F "|" '{print $1}') REMOTE_CALL=${REMOTE_CALL^^} IP=$(echo $PEER | awk -F "|" '{print $2}') #create shortcut SC="telnet://{mycall}:CMSTelnet@$IP:8774/wl2k" #mod config file jq '.connect_aliases += {'\"P2P-"$REMOTE_CALL"-"$IP"\"' : '\"$SC\"'}' $CONFIG > $TEMP_CONFIG cp $TEMP_CONFIG $CONFIG sudo systemctl restart pat@$WHO #give user notice yad --form --width=420 --text-align=center --center --title="P2P Alias Add" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="P2P Alias Added" \ --button=gtk-ok $MAIN fi } AUTOMODEM(){ CONF=$HOME/patmenu2/.autostart.conf HTTP_ADDR=$(grep http_addr $HOME/.config/pat/config.json | sed 's/.*": "//;s/:.*//') #pat server check if [ "$HTTP_ADDR" = '127.0.0.1' ]; then yad --form --width=420 --text-align=center --center --title="Auto Modem Start" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="The Pat mailbox server is currently set to only accept connections from the Pi itself. \ Typically if using the auto modem start feature, you will be accessing the Pat mailbox from \ another device. Would you like to configure the system to accept connections over the network?" \ --button="Keep Current Settings":1 \ --button="Allow Network Connections":2 BUT=$? if [ $BUT = 2 ]; then cp $HOME/.config/pat/config.json $HOME/.config/pat/config.json.bkup sed -i 's/127.0.0.1/0.0.0.0/' $HOME/.config/pat/config.json sudo systemctl restart pat@`whoami` fi fi source $CONF #Figure out which modem (if any) is set to auto start already and give it a pretty name. CUR=$(echo $AUTO_CMD | awk -F "/" '{print $NF}') if [ -z $CUR ]; then echo else if [ $CUR = 'start-vara-hf' ]; then CUR=VARA-HF elif [ $CUR = 'start-vara-fm' ]; then CUR=VARA-FM elif [ $CUR = 'start-pat-ardop' ]; then CUR=ARDOP elif [ $CUR = 'start-pat2m' ]; then CUR=Packet fi fi #check to see if we already have a autostart in place. Give user #a chance to delete before adding a new one. Can only have one #modem starting at a time. if [ -f $CONF ]; then yad --form --width=420 --text-align=center --center --title="Auto Modem Start" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Existing Auto Start Found - $CUR\rYou must delete the existing auto start before creating a new one. \ Only one modem at a time can be set to auto start at boot." \ --button="Delete Current":1 \ --button="Keep Current":2 BUT=$? if [ $BUT = 1 ]; then crontab -l > /run/user/$UID/tempcron.txt rm $CONF sed -i '/patmenu2\/start/d' /run/user/$UID/tempcron.txt crontab /run/user/$UID/tempcron.txt elif [ $BUT = 2 ]; then $MAIN & exit elif [ $BUT = 252 ]; then exit fi fi AUTO=$(yad --form --width=420 --text-align=center --center --title="Auto Modem Start" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="Auto Modem Start by KM4ACK" \ --field="Auto Start Modem on Boot":CB "NONE|VARA|VARA-FM|ARDOP|Packet") BUT=$? AUTO=$(echo $AUTO | awk -F "|" '{print $1}') #give user chance to exit/cancel if [ $BUT = 252 ]; then exit elif [ $BUT = 1 ]; then $MAIN & exit fi #set command per user selection if [ "$AUTO" = 'VARA' ]; then echo "VARA Selected" AUTO_CMD="sleep 15 && export DISPLAY=:0 && $HOME/patmenu2/start-vara-hf" elif [ "$AUTO" = 'VARA-FM' ]; then echo "VARA FM Selected" AUTO_CMD="sleep 15 && export DISPLAY=:0 && $HOME/patmenu2/start-vara-fm" elif [ "$AUTO" = 'ARDOP' ]; then echo "ARDOP Selected" AUTO_CMD="sleep 15 && export DISPLAY=:0 && $HOME/patmenu2/start-pat-ardop" elif [ "$AUTO" = 'Packet' ]; then echo "Packet Selected" AUTO_CMD="sleep 15 && export DISPLAY=:0 && $HOME/patmenu2/start-pat2m" elif [ "$AUTO" = 'NONE' ]; then $MAIN & exit fi #send the command to the conf file echo "AUTO_CMD=\"$AUTO_CMD\"" > $CONF #add auto start to current cron job crontab -l > /run/user/$UID/tempcron.txt echo "@reboot $AUTO_CMD" >> /run/user/$UID/tempcron.txt crontab /run/user/$UID/tempcron.txt #give user feedback yad --form --width=420 --text-align=center --center --title="Auto Modem Start" --text-align=center \ --image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \ --text="$AUTO will auto start at boot\r\rIMPORTANT NOTE!\rThe sound card MUST be plugged in \ before booting the Pi or the auto start feature will FAIL." \ --button=gtk-ok $MAIN & exit }