forked from km4ack/Pi-APRS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi-aprs
executable file
·90 lines (67 loc) · 2.27 KB
/
pi-aprs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
#GUI interface for working ISS via APRS
#Based on work by Scott Chapman K4KDR
#20200413 KM4ACK
MYPATH=$HOME/Pi-APRS
source $MYPATH/config
TODAY=$(date +%d%b%y-%H%M)
mkdir -p $MSGPATH
#Verify not running as root
WHO=$(whoami)
if [ $WHO = 'root' ]; then
echo "no need to run with sudo"
exit
fi
#verify callsign has been set
if [ $MYCALL = "N0CALL" ]; then
yad --width=350 --height=75 --title="N0CALL" --timeout=5 --timeout-indicator=top --no-buttons --center --text="Please choose settings and enter your call sign before using the app"
fi
#Verify needed dependencies are installed
#check if YAD is installed
if ! hash yad 2>/dev/null; then
echo "YAD isn't installed. Please install and try again"
exit
fi
#check if direwolf is installed
if ! hash direwolf 2>/dev/null; then
echo "Direwolf isn't installed. Please install and try again"
exit
fi
#check if ax25 is installed
AX=$(ls /etc/ax25)
if [ -z "$AX" ]; then
echo "AX25 isn't installed. Please install and try again"
exit
fi
yad --form --width=400 --image $HOME/Pi-APRS/ISS.png --window-icon=$HOME/Pi-APRS/ISS.png --image-on-top --text="<b>Pi-APRS</b> by KM4ACK" --text-align=center --center --title="Pi-APRS" \
--field="Free Message":fbtn "bash -c 'source $MYPATH/functions; FREEMSG'" \
--field="Status":fbtn "bash -c 'source $MYPATH/functions; SENDSTAT'" \
--field="Heard You":fbtn "bash -c 'source $MYPATH/functions; HEARDU'" \
--field="QSL73":fbtn "bash -c 'source $MYPATH/functions; QSL73'" \
--field="Send Position":fbtn "bash -c 'source $MYPATH/functions; SENDPOS'" \
--field="Start Modems":fbtn "bash -c 'source $MYPATH/functions; STARTMODEM'" \
--field="Settings":fbtn "bash -c 'source $MYPATH/functions; MYCONFIG'" \
--field="Your Call $MYCALL":LBL \
--button=gtk-quit:1
QUIT=$?
if [ $QUIT = 1 ] || [ $QUIT = 252 ]; then
DIRE=$(pidof direwolf)
KISS=$(pidof kissutil)
if [ -z "$DIRE" ] && [ -z "$KISS" ]
then
echo "Exiting"
else
echo
echo "######################"
echo " SHUTTING DOWN "
echo "######################"
echo
MSGID=$(ps -aux | grep msg-alert | head -1 | awk '{ print $2}')
kill $MSGID
sudo killall kissutil > /dev/null 2>&1
sudo killall direwolf > /dev/null 2>&1
mkdir -p $HOME/Pi-APRS/logs/
cp /run/user/1000/pi-aprs.log $MYPATH/logs/log.$TODAY
echo "Shutdown complete"
fi
fi