mirror of
https://github.com/km4ack/patmenu2.git
synced 2025-05-16 14:50:13 -07:00
add quick stats
This commit is contained in:
parent
6ec99fb70b
commit
2a3ebf47e3
@ -358,7 +358,102 @@ yad --form --width=400 --text-align=center --center --title="Grid Update" --text
|
|||||||
$MAIN
|
$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="<b>Pat Listen Modes</b>\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 <<EOF > $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="<b>Listen mode set to $TELNET$ARDOP$AX25</b>" \
|
||||||
|
--button=gtk-ok
|
||||||
|
$MAIN &
|
||||||
|
exit
|
||||||
|
|
||||||
|
elif [ $BUT = 3 ]; then
|
||||||
|
cat <<EOF > $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="<b>No longer listening for incoming connections</b>" \
|
||||||
|
--button=gtk-ok
|
||||||
|
$MAIN &
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user