-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathwl2k_gateway.setup
More file actions
108 lines (87 loc) · 2.44 KB
/
wl2k_gateway.setup
File metadata and controls
108 lines (87 loc) · 2.44 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
#This script installs screen if not already installed and
#installs my script to autostart the WL2k gateway at boot.
TEMP_DIR=/run/user/$UID
MAIN(){
NOTICE
#install screen if not already
if ! hash screen 2>/dev/null; then
echo "#######################"
echo "screen app not detected"
echo "installing screen"
echo "#######################"
sleep 1
sudo apt update
sudo apt install -y screen
fi
GATEWAY_START
BPQ_START
echo; echo "Installation complete. linbpq should auto start at boot"
echo "See gateway-commands.txt desktop after reboot"
}
#############
#Sub-routines
#############
NOTICE(){
clear;echo
cat <<EOF
#########################################
KM4ACK Gateway Auto Start Install
#########################################
This script will install screen if needed
and install the KM4ACK gateway startup script.
The function of this is to auto start your gateway
when the pi boots.
Enjoy! de KM4ACK
EOF
read -n 1 -s -r -p "Press any key to continue"
echo ""
}
GATEWAY_START(){
#create gateway start script and move to appropriate location
echo "#################################"
echo "installing gateway startup script"
echo "#################################"
cat <<"EOFF" > $TEMP_DIR/gateway-start
#!/bin/bash
#Start Direwolf
/usr/bin/screen -S dw -d -m /usr/local/bin/direwolf -p
sleep 2
#Start kissattach
LINK=$(ls -l /tmp/kisstnc | awk '{print $NF}')
sudo /usr/sbin/kissattach $LINK wl2k
sudo kissparms -c 1 -p wl2k
#start bpq server
cd $HOME/linbpq
/usr/bin/screen -S bpq -d -m $HOME/linbpq/linbpq
#notice to user
if [ ! -f $HOME/Desktop/gateway-commands.txt ]; then
cat <<EOF > $HOME/Desktop/gateway-commands.txt
###################################
KM4ACK Gateway Start Script
###################################
To verify direwolf stated you can run:
screen -r dw
To exit, press ctrl+a followed by d
To verify LinBPQ started you can run:
screen -r bpq
To exit, press ctrl+a followed by d
Need help configuring BPQ? See https://groups.io/g/bpq32/topics
73, de KM4ACK
EOF
fi
EOFF
chmod +x $TEMP_DIR/gateway-start
sudo mv $TEMP_DIR/gateway-start /usr/local/bin/
}
BPQ_START(){
echo "##########################"
echo "installing BPQ cron job"
echo "##########################"
crontab -l > /run/user/$UID/cron.txt
echo "#Winlink Gateway Auto Start at Boot" >> /run/user/$UID/cron.txt
echo "@reboot sleep 20 && /usr/local/bin/gateway-start" >> /run/user/$UID/cron.txt
crontab /run/user/$UID/cron.txt
}
#Call main portion of script
MAIN