forked from km4ack/pi-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addon-build-a-pi
334 lines (286 loc) · 9.42 KB
/
addon-build-a-pi
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
#!/bin/bash
#MAIN SCRIPT FOR NEW PI BUILD
#20191210 KM4ACK
#Credit to TB-14 for the inspiration for this script
MYDIR=$HOME/pi-build
DIR=$HOME/temp
mkdir -p $DIR
TEMPCRON=$DIR/tempcron
touch $TEMPCRON
WHO=$(whoami)
RB=$(ls $HOME/.config/ | grep KM4ACK)
LOG=$HOME/Documents/mylog.txt
CALL=$(cat $MYDIR/callsign.txt)
touch $LOG
RTC=$(ls $HOME | grep RTC)
if [ -z "$RTC" ]
then
echo
else
echo "##################################################"
echo "##########INSTALLING REAL TIME CLOCK"
echo "##################################################"
sleep 2
echo;echo;echo "Please be sure the real time clock is installed on the GPIO pins"
read -n 1 -s -r -p "Press any key to continue once the RTC is installed"
cd $DIR
wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/rtc
bash $DIR/rtc
fi
##########################################
MAIN () {
yad --height=600 --width=400 --center --list --checklist --column=Install --column=App --separator="," --text "Select the apps you wish to install." --title="Build-a-Pi by KM4ACK" --button="Exit:1" --button="Install Selected:2" < $MYDIR/addon-app-list > $MYDIR/appchoices
BUTTON=$?
if [ $BUTTON = "3" ]
then
yad --width=500 --height=500 --center --button="Close:1" --wrap --text-info < info.txt
MAIN
elif [ $BUTTON = "252" ]
then
exit 0
elif [ $BUTTON = "1" ]
then
exit 0
fi
echo $BUTTON
cat $MYDIR/appchoices | sed 's/TRUE,//g' | sed 's/,//' | sed 's/$/=yes/' > $MYDIR/config2
rm $MYDIR/appchoices
};export -f MAIN
MAIN
############################################################################
source $MYDIR/config2
if [ $GARIM = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING GARIM"
echo "##################################################"
sleep 2
cd $HOME
sudo apt-get install -y fluid
wget https://www.whitemesa.net/garim/src/garim-1.1.tar.gz
tar xzvf garim-1.1.tar.gz
rm garim-1.1.tar.gz
cd $HOME/garim-1.1
./configure
make
sudo make install
fi
if [ $CHIRP = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING CHIRP"
echo "##################################################"
sleep 2
cd $DIR
wget https://trac.chirp.danplanet.com/chirp_daily/LATEST/
CHIRPBUILD=$(cat index.html | grep .tar.gz | grep chirp-daily- | awk '{ print $6 }' | sed 's/.*"//' | sed 's/>//' | sed 's/[<].*$//')
sudo apt-get -y install python-gtk2 python-serial python-libxml2
mkdir $HOME/chirp
cd $HOME/chirp
wget https://trac.chirp.danplanet.com/chirp_daily/LATEST/$CHIRPBUILD
tar -xzf $CHIRPBUILD
CHIRPDIR=$(echo $CHIRPBUILD | sed 's/[.].*$//')
cd $CHIRPDIR
sudo python setup.py install
fi
if [ $XASTIR = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING XASTIR"
echo "##################################################"
sleep 2
sudo apt-get install -y xastir
sudo sed -i 's/Exec=xastir/Exec=sudo xastir/' /usr/share/applications/xastir.desktop
fi
if [ $YAAC = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING YAAC"
echo "##################################################"
sleep 2
cd $DIR
wget https://www.ka2ddo.org/ka2ddo/YAAC.zip
sudo apt-get install -y openjdk-8-jre librxtx-java
mkdir -p $HOME/YAAC
cd $HOME/YAAC
touch YAAC
echo "#!/bin/bash" >> YAAC
echo "java -jar $HOME/YAAC/YAAC.jar" >> YAAC
chmod +x YAAC
#ln -sf $HOME/YAAC/YAAC $HOME/Desktop/YAAC
#ln -sf $HOME/YAAC/YAAC $HOME/bin/YAAC
cat > yaac.desktop <<EOF
[Desktop Entry]
Name=YAAC
GenericName=YAAC
Comment=APRS Client
Exec=$HOME/YAAC/YAAC
Terminal=false
Type=Application
Categories=Network;HamRadio;
EOF
sudo mv yaac.desktop /usr/share/applications/
unzip $DIR/YAAC.zip
fi
if [ $EES = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING KM4ACK EMERGENCY EMAIL SERVER"
echo "##################################################"
sleep 2
#install PHP7.3 if not installed
#this will also install apache2
if ! hash php7.3 2>/dev/null; then
sudo apt install -y php7.3
fi
#install ghostwriter if needed
#this is used to mod the new index.html
#page. 20200229
if ! hash ghostwriter 2>/dev/null; then
sudo apt-get install -y ghostwriter
fi
#Install the KM4ACK EES
cd $DIR
#comment out master branch and add dev branch 20200229 km4ack----------------------------------------
#wget https://github.com/km4ack/EES-LITE/archive/master.zip
#unzip master.zip
wget https://github.com/km4ack/EES-LITE/archive/dev.zip
unzip dev.zip
sudo cp -r $DIR/EES-LITE-dev/* /var/www/html/
#sudo cp -r $DIR/EES-LITE-master/* /var/www/html/
rm -rf $DIR/EES-LITE-master
rm $DIR/master.zip
cd /var/www/html
sudo chmod +x /var/www/html/firstrun
sudo /var/www/html/./firstrun
#line below commented out while testing new index.html file 20200229 km4ack---------------------------
#sudo mv /var/www/html/index.html /var/www/html/index.html.org
sudo sed -i "s/N0CALL/$CALL/" /var/www/html/config.php
sudo sed -i 's/REMINDER\ FOR\ OPERATOR\ TO\ DO\ SOMETHING/ENABLE\ AUTO\ POST\ REPLY\ IN\ CRON/' /var/www/html/config.php
cd $DIR
#Change Pat Winlink port so it won't interfer with the EES
sed -i 's/0.0.0.0:8080/0.0.0.0:5000/' $HOME/.wl2k/config.json
sed -i 's/PORT=8080/PORT=5000/' $HOME/patmenu/config
sudo killall pat
sudo systemctl start pat@pi
fi
#Move info.markdown from EES folder to Documents
sudo mv /var/www/html/info.markdown /home/pi/Documents/
sudo chown pi:pi /home/pi/Documents/info.markdown
#move info.html to pi documents folder
sudo cp /var/www/html/index.html /home/pi/Documents/info.html
sudo chown pi:pi /home/pi/Documents/info.html
#move script to be run by cron to bin dir
sudo mv /var/www/html/webcopy /home/pi/bin/
sudo chown pi:pi /home/pi/bin/webcopy
sudo chmod +x /home/pi/bin/webcopy
#set EES schedule using EES script
/var/www/html/./schedule > /dev/null 2>&1
if [ $PYQSO = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING PYQSO########################"
echo "##################################################"
sudo apt-get install -y pyqso
fi
if [ $GPREDICT = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING GPREDICT#####################"
echo "##################################################"
sudo apt-get install -y gpredict
fi
if [ $CQRLOG = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING CQRLOG#######################"
echo "##################################################"
sudo apt-get install -y cqrlog
fi
if [ $GRIDTRACKER = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING GRIDTRACKER##################"
echo "##################################################"
cd $HOME
sudo apt-get install -y libgconf-2-4
GRIDDLL=$(curl -s https://tagloomis.com/downloads/ | grep Arm | head -1 | sed 's/<p><a\ href="//' | sed 's/?.*$//')
wget $GRIDDLL
GRIDTAR=$(echo $GRIDDLL | sed 's/.*\///g')
tar -xzvf $GRIDTAR
rm *.gz
cat > gridtracker.desktop <<EOF
[Desktop Entry]
Name=GridTracker
Comment=GridTracker
GenericName=GridTracker, a WSJT-X Companion
Exec=/home/pi/GridTracker/GridTracker --disable-accelerated-2d-canvas --num-raster-threads=2
Icon=/home/pi/GridTracker/gridtracker.png
Path=/home/pi/GridTracker
Type=Application
Encoding=UTF-8
Terminal=false
Categories=HamRadio;
EOF
sudo mv gridtracker.desktop /usr/share/applications/
fi
if [ $QSSTV = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING QSSTV##################"
echo "##################################################"
sudo apt-get install -y g++ libfftw3-dev qt5-default libpulse-dev libhamlib-dev libasound2-dev libv4l-dev libopenjp2-7 libopenjp2-7-dev
cd $HOME/Downloads
TAR=$(curl -s https://users.telenet.be/on4qz/qsstv/downloads/ | grep tar.gz | sed 's/.*href="//' | sed 's/">.*$//')
wget https://users.telenet.be/on4qz/qsstv/downloads/$TAR
SSTVTAR=$(echo $TAR | sed 's/.tar.gz//')
tar -xvzf $TAR
cd $SSTVTAR
qmake
make
sudo make install
sudo sed -i 's/Education;/Network;HamRadio;/' /usr/local/share/applications/qsstv.desktop
fi
if [ $PROPAGATION = "yes" ] > /dev/null 2>&1
then
echo;echo;echo
echo "##################################################"
echo "##########INSTALLING PROPAGATION SOFTWARE#########"
echo "##################################################"
sudo apt-get install -y gfortran yelp python3-gi python3-gi-cairo rarian-compat gnome-doc-utils pkg-config python3-dateutil python3-mpltoolkits.basemap python3-cairocffi libgtk-3-dev
#install primary program
cd $HOME/Downloads
wget https://www.qsl.net/hz1jw/voacapl/downloads/voacapl-0.7.2.tar.gz
tar -xzf voacapl-0.7.2.tar.gz
cd voacapl-0.7.2
./configure
make
sudo make install
#install gui app for propagation reports
cd $HOME/Downloads
wget https://www.qsl.net/hz1jw/pythonprop/downloads/pythonprop-0.28.tar.gz
tar -xzf pythonprop-0.28.tar.gz
cd pythonprop-0.28
./configure
sudo make install
fi
$HOME/Downloads/voacapl-0.7.2/makeitshfbc
rm -rf $DIR
crontab -l > $HOME/Downloads/crontemp.txt
sed -i 's/@reboot\ sleep\ 20\ &&\ export\ DISPLAY=:0\ &&\ lxterminal.*$//' $HOME/Downloads/crontemp.txt
crontab $HOME/Downloads/crontemp.txt
rm $HOME/Downloads/crontemp.txt
sudo apt-get autoremove -y
echo;echo;echo "rebooting in 5 seconds"
sleep 5
sudo reboot