-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_winterhill.sh
executable file
·230 lines (197 loc) · 8.11 KB
/
install_winterhill.sh
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
#!/bin/bash
# WinterHill 3v20 install file
# G8GKQ 6 Mar 2021
# Winterhill for a 1920 x 1080 screen
whoami | grep -q pi
if [ $? != 0 ]; then
echo "Install must be performed as user pi"
exit
fi
# Check which source needs to be loaded
GIT_SRC="BritishAmateurTelevisionClub"
GIT_SRC_FILE=".wh_gitsrc"
if [ "$1" == "-d" ]; then
GIT_SRC="davecrump"; # G8GKQ
#GIT_SRC="foxcube"; # G4EWJ
echo
echo "-------------------------------------------------------"
echo "----- Installing development version of WinterHill-----"
echo "-------------------------------------------------------"
elif [ "$1" == "-u" -a ! -z "$2" ]; then
GIT_SRC="$2"
echo
echo "WARNING: Installing ${GIT_SRC} development version, press enter to continue or 'q' to quit."
read -n1 -r -s key;
if [[ $key == q ]]; then
exit 1;
fi
echo "ok!";
else
echo
echo "------------------------------------------------------------"
echo "----- Installing BATC Production version of WinterHill -----"
echo "------------------------------------------------------------"
fi
cd /home/pi
echo "--------------------------------------------------------"
echo "----- Disabling the raspberry ssh password warning -----"
echo "--------------------------------------------------------"
echo
sudo mv /etc/xdg/lxsession/LXDE-pi/sshpwd.sh /etc/xdg/lxsession/LXDE-pi/sshpwd.sh.old
echo "------------------------------------"
echo "---- Loading required packages -----"
echo "------------------------------------"
echo
sudo apt-get -y install xdotool xterm raspberrypi-kernel-headers
echo "--------------------------------------------------------------"
echo "---- Put the Desktop Toolbar at the bottom of the screen -----"
echo "--------------------------------------------------------------"
echo
cd /home/pi/.config/lxpanel/LXDE-pi/panels
sed -i "/^ edge=top/c\ edge=bottom" panel
cd /home/pi
echo "----------------------------------------------------"
echo "---- Increasing gpu memory in /boot/config.txt -----"
echo "----------------------------------------------------"
echo
sudo bash -c 'echo -e "\n##Increase GPU Memory" >> /boot/config.txt'
sudo bash -c 'echo -e "gpu_mem=128\n" >> /boot/config.txt'
echo "-------------------------------------------------"
echo "---- Set force_turbo for constant spi speed -----"
echo "-------------------------------------------------"
echo
sudo bash -c 'echo -e "##Set force_turbo for constant spi speed" >> /boot/config.txt'
sudo bash -c 'echo -e "force_turbo=1\n" >> /boot/config.txt'
echo "--------------------------------------"
echo "---- Set the spi ports correctly -----"
echo "--------------------------------------"
echo
sudo sed -i "/^#dtparam=spi=on/c\dtparam=spi=off\ndtoverlay=spi5-1cs" /boot/config.txt
echo "----------------------------------------------"
echo "---- Setting Framebuffer to 32 bit depth -----"
echo "----------------------------------------------"
echo
sudo sed -i "/^dtoverlay=vc4-fkms-v3d/c\#dtoverlay=vc4-fkms-v3d" /boot/config.txt
echo "------------------------------------------------------------"
echo "---- Setting GUI to start with or without HDMI display -----"
echo "------------------------------------------------------------"
echo
sudo sed -i "/^#hdmi_force_hotplug=1/c\hdmi_force_hotplug=1" /boot/config.txt
echo "-------------------------------------------"
echo "---- Download the WinterHill Software -----"
echo "-------------------------------------------"
echo
cd /home/pi
wget https://github.com/${GIT_SRC}/winterhill/archive/main.zip
unzip -o main.zip
mv winterhill-main winterhill
rm main.zip
BUILD_VERSION=$(</home/pi/winterhill/latest_version.txt)
echo INSTALL WinterHill build started version $BUILD_VERSION > /home/pi/winterhill/whlog.txt
echo "------------------------------------------"
echo "---- Building spi driver for install -----"
echo "------------------------------------------"
echo
cd /home/pi/winterhill/whsource-3v20/whdriver-3v20
make
if [ $? != 0 ]; then
echo "------------------------------------------"
echo "- Failed to build the WinterHill Driver --"
echo "------------------------------------------"
echo INSTALL Initial make of driver failed >> /home/pi/winterhill/whlog.txt
exit
fi
# sudo rmmod whdriver-2v22.ko # Use in future update scripts
sudo insmod whdriver-3v20.ko
if [ $? != 0 ]; then
echo "------------------------------------------"
echo "--- Failed to load WinterHill Driver -----"
echo "------------------------------------------"
echo INSTALL Initial insmod of driver failed >> /home/pi/winterhill/whlog.txt
exit
fi
cat /proc/modules | grep -q 'whdriver_3v20'
if [ $? != 0 ]; then
echo "-------------------------------------------------------------"
echo "--- Failed to find previously loaded WinterHill Driver -----"
echo "-------------------------------------------------------------"
echo INSTALL Initial check of driver failed >> /home/pi/winterhill/whlog.txt
exit
else
echo
echo "------------------------------------------------"
echo "--- Successfully loaded WinterHill Driver -----"
echo "------------------------------------------------"
echo INSTALL Driver Successfully loaded >> /home/pi/winterhill/whlog.txt
echo
fi
cd /home/pi
echo "------------------------------------------------"
echo "---- Set up to load the spi driver at boot -----"
echo "------------------------------------------------"
echo
sudo sed -i "/^exit 0/c\cd /home/pi/winterhill/whsource-3v20/whdriver-3v20\nsudo insmod whdriver-3v20.ko\nexit 0" /etc/rc.local
echo "---------------------------------------------------"
echo "---- Building the main WinterHill Application -----"
echo "---------------------------------------------------"
echo
cd /home/pi/winterhill/whsource-3v20/whmain-3v20
make
if [ $? != 0 ]; then
echo "----------------------------------------------"
echo "- Failed to build the WinterHill Application -"
echo "----------------------------------------------"
echo INSTALL make of main application failed >> /home/pi/winterhill/whlog.txt
exit
fi
cp winterhill-3v20 /home/pi/winterhill/RPi-3v20/winterhill-3v20
cd /home/pi
echo "--------------------------------------"
echo "---- Building the PIC Programmer -----"
echo "--------------------------------------"
echo
cd /home/pi/winterhill/whsource-3v20/whpicprog-3v20
./make.sh
if [ $? != 0 ]; then
echo "--------------------------------------"
echo "- Failed to build the PIC Programmer -"
echo "--------------------------------------"
echo INSTALL make of PIC Programmer failed >> /home/pi/winterhill/whlog.txt
exit
fi
cp whpicprog-3v20 /home/pi/winterhill/PIC-3v20/whpicprog-3v20
cd /home/pi
echo "--------------------------------------------"
echo "---- Copy the shortcuts to the desktop -----"
echo "--------------------------------------------"
echo
cp /home/pi/winterhill/configs/Kill_WH /home/pi/Desktop/Kill_WH
cp /home/pi/winterhill/configs/WH_Local /home/pi/Desktop/WH_Local
cp /home/pi/winterhill/configs/WH_Anyhub /home/pi/Desktop/WH_Anyhub
cp /home/pi/winterhill/configs/WH_Anywhere /home/pi/Desktop/WH_Anywhere
cp /home/pi/winterhill/configs/WH_Multihub /home/pi/Desktop/WH_Multihub
cp /home/pi/winterhill/configs/WH_Fixed /home/pi/Desktop/WH_Fixed
cp /home/pi/winterhill/configs/PIC_Prog /home/pi/Desktop/PIC_Prog
cp /home/pi/winterhill/configs/Show_IP /home/pi/Desktop/Show_IP
cp /home/pi/winterhill/configs/Shutdown /home/pi/Desktop/Shutdown
cp /home/pi/winterhill/configs/Check_for_Update /home/pi/Desktop/Check_for_Update
echo "--------------------------------------------------------------------"
echo "---- Enable Autostart for the selected WinterHill mode at boot -----"
echo "--------------------------------------------------------------------"
echo
mkdir /home/pi/.config/autostart
cp /home/pi/winterhill/configs/startup.desktop /home/pi/.config/autostart/startup.desktop
# Save git source used
echo "${GIT_SRC}" > /home/pi/${GIT_SRC_FILE}
echo
echo "SD Card Serial:"
cat /sys/block/mmcblk0/device/cid
# Reboot
echo
echo "--------------------------------"
echo "----- Complete. Rebooting -----"
echo "--------------------------------"
echo INSTALL Reached end of install script >> /home/pi/winterhill/whlog.txt
sleep 1
sudo reboot now
exit