@@ -82,17 +82,6 @@ apt_pkg_install() {
82
82
fi
83
83
}
84
84
85
- pip_install () {
86
- echo " Installing Python module $1 ..."
87
- if ! { sudo -H pip3 install " $1 " & > /dev/null; } then
88
- if [[ ! $2 == " optional" ]]; then
89
- failout " Failed to install $1 !"
90
- else
91
- warning " Failed to install $1 !"
92
- fi
93
- fi
94
- }
95
-
96
85
97
86
sleep 1 # give curl time to print info
98
87
@@ -122,7 +111,7 @@ https://github.com/GeekFunkLabs/fluidpatcher
122
111
Report issues with this script at
123
112
https://github.com/GeekFunkLabs/fluidpatcher/issues
124
113
125
- Choose your install options. Empty responses will use the [default options ].
114
+ Choose your install options. An empty response will use the [default option ].
126
115
Setup will begin after all questions are answered.
127
116
"
128
117
@@ -131,12 +120,13 @@ if test -f /etc/os-release; then
131
120
if ! { grep -q ^Raspberry /proc/device-tree/model; } then
132
121
ENVCHECK=false
133
122
fi
134
- if ! { grep -q bullseye /etc/os-release; } then
123
+ if ! { grep -q " bullseye\|bookworm " /etc/os-release; } then
135
124
ENVCHECK=false
136
125
fi
137
126
fi
138
127
if ! ($ENVCHECK ); then
139
- warning " This software is designed for the latest Raspberry Pi OS (Bullseye),"
128
+ warning " This software is designed for a Raspberry Pi computer"
129
+ warning " running Raspberry Pi OS bullseye or bookworm,"
140
130
warning " which does not appear to be the situation here. YMMV!"
141
131
if noyes " Proceed anyway?" ; then
142
132
exit 1
@@ -153,16 +143,21 @@ if [[ $installtype == 1 ]]; then
153
143
inform " This script must reboot your computer to activate your sound card."
154
144
inform " Once this is complete, run this script again to continue setup."
155
145
if yesno " Reboot?" ; then
156
- sudo sed -i ' $ a\dtoverlay=hifiberry-dac' /boot/config.txt
146
+ if test -d /boot/firmware; then
147
+ sudo sed -i ' $ a\dtoverlay=hifiberry-dac' /boot/firmware/config.txt
148
+ else
149
+ sudo sed -i ' $ a\dtoverlay=hifiberry-dac' /boot/config.txt
150
+ fi
157
151
sync; sudo reboot
152
+ exit 0
158
153
fi
159
154
fi
160
155
echo " What version of SquishBox hardware are you using?"
161
156
echo " v6 - Green PCB with SMT components"
162
157
echo " v4 - Purple PCB, has 2 resistors and LED"
163
158
echo " v3 - Purple PCB, has 1 resistor"
164
159
echo " v2 - Hackaday/perfboard build"
165
- query " Choose " " v6" ; hw_version=$response
160
+ query " Enter version code " " v6" ; hw_version=$response
166
161
elif [[ $installtype == 2 ]]; then
167
162
echo " Set up controls for Headless Pi Synth:"
168
163
query " MIDI channel for controls" " 1" ; ctrls_channel=$response
@@ -233,22 +228,18 @@ if [[ $install_synth ]]; then
233
228
# get dependencies
234
229
inform " Installing/Updating supporting software..."
235
230
sysupdate
236
- apt_pkg_install " python3-pip"
231
+ apt_pkg_install " python3-yaml"
232
+ apt_pkg_install " python3-rpi.gpio"
237
233
apt_pkg_install " fluid-soundfont-gm"
238
234
apt_pkg_install " ladspa-sdk" optional
239
235
apt_pkg_install " swh-plugins" optional
240
236
apt_pkg_install " tap-plugins" optional
241
237
apt_pkg_install " wah-plugins" optional
242
- pip_install " oyaml"
243
- if [[ $installtype == 1 ]]; then
244
- pip_install " RPi.GPIO"
245
- pip_install " RPLCD"
246
- fi
247
238
248
239
# install/update fluidpatcher
249
- FP_VER =` sed -n ' /^VERSION /s|[^0-9\.]*||gp' $installdir /patcher /__init__.py & > /dev/null`
250
- NEW_FP_VER =` curl -s https://api.github.com/repos/GeekFunkLabs/fluidpatcher/releases/latest | sed -n ' /tag_name/s|[^0-9\.]*||gp' `
251
- if [[ ! $FP_VER == $NEW_FP_VER ]]; then
240
+ CUR_FP_VER =` sed -n ' /^__version__ /s|[^0-9\.]*||gp' $installdir /fluidpatcher /__init__.py & > /dev/null`
241
+ FP_VER =` curl -s https://api.github.com/repos/GeekFunkLabs/fluidpatcher/releases/latest | sed -n ' /tag_name/s|[^0-9\.]*||gp' `
242
+ if [[ ! $CUR_FP_VER == $FP_VER ]]; then
252
243
inform " Installing/Updating FluidPatcher version $NEW_FP_VER ..."
253
244
wget -qO - https://github.com/GeekFunkLabs/fluidpatcher/tarball/master | tar -xzm
254
245
fptemp=` ls -dt GeekFunkLabs-fluidpatcher-* | head -n1`
@@ -265,12 +256,9 @@ if [[ $install_synth ]]; then
265
256
fi
266
257
267
258
# compile/install fluidsynth
268
- # FS_VER=`fluidsynth --version 2> /dev/null | sed -n '/runtime version/s|[^0-9\.]*||gp'`
269
- # BUILD_FS_VER=`curl -s https://api.github.com/repos/FluidSynth/fluidsynth/releases/latest | sed -n '/tag_name/s|[^0-9\.]*||gp'`
270
- # prefer FluidSynth version 2.3.2 until https://github.com/FluidSynth/fluidsynth/issues/1272 is remedied
271
- FS_VER=' 0'
272
- BUILD_FS_VER=' 2.3.2'
273
- if [[ ! $FS_VER == $BUILD_FS_VER ]]; then
259
+ CUR_FS_VER=` fluidsynth --version 2> /dev/null | sed -n ' /runtime version/s|[^0-9\.]*||gp' `
260
+ FS_VER=' 2.3.4'
261
+ if [[ ! $CUR_FS_VER == $FS_VER ]]; then
274
262
inform " Compiling latest FluidSynth from source..."
275
263
echo " Getting build dependencies..."
276
264
if { grep -q ^# deb-src /etc/apt/sources.list; } then
@@ -282,10 +270,8 @@ if [[ $install_synth ]]; then
282
270
|| echo E: install failed; } | grep ' ^[WE]:' ; then
283
271
warning " Couldn't get all dependencies!"
284
272
fi
285
- # wget -qO - https://github.com/FluidSynth/fluidsynth/tarball/master | tar -xzm
286
- wget -qO - https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v2.3.2.tar.gz | tar -xzm
287
- # fstemp=`ls -dt FluidSynth-fluidsynth-* | head -n1`
288
- fstemp=' fluidsynth-2.3.2'
273
+ wget -qO - https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v$BUILD_FS_VER .tar.gz | tar -xzm
274
+ fstemp=` ls -dt fluidsynth-* | head -n1`
289
275
mkdir $fstemp /build
290
276
cd $fstemp /build
291
277
echo " Configuring..."
@@ -295,7 +281,7 @@ if [[ $install_synth ]]; then
295
281
if { sudo make install; } then
296
282
sudo ldconfig
297
283
else
298
- warning " Unable to compile FluidSynth $BUILD_VER "
284
+ warning " Unable to compile FluidSynth $BUILD_VER - installing from package repository "
299
285
apt_pkg_install " fluidsynth"
300
286
fi
301
287
cd ../..
319
305
if [[ $installtype == 1 ]]; then
320
306
inform " Enabling SquishBox startup service..."
321
307
chmod a+x $installdir /squishbox.py
308
+ chmod a+x $installdir /lcdsplash.py
309
+ SB_VER=` sed -n ' /^__version__/s|[^0-9\.]*||gp' $installdir /squishbox.py & > /dev/null`
310
+ sed -i " /^HW_VERSION/s|[v0-9]\+|$hw_version |" $installdir /squishbox.py
311
+ sed -i " /^HW_VERSION/s|[v0-9]\+|$hw_version |" $installdir /lcdsplash.py
312
+ sed -i " /^SB_VERSION/s|[0-9\.]\+|$SB_VER |" $installdir /lcdsplash.py
313
+ sed -i " /^FP_VERSION/s|[0-9\.]\+|$FP_VER |" $installdir /lcdsplash.py
322
314
cat << EOF | sudo tee /etc/systemd/system/squishbox.service
323
315
[Unit]
324
316
Description=SquishBox
@@ -333,13 +325,31 @@ Restart=on-failure
333
325
334
326
[Install]
335
327
WantedBy=multi-user.target
328
+ EOF
329
+ cat << EOF | sudo tee /etc/systemd/system/lcdsplash.service
330
+ [Unit]
331
+ Description=LCD Splashscreen
332
+ DefaultDependencies=false
333
+
334
+ [Service]
335
+ Type=oneshot
336
+ ExecStart=$installdir /lcdsplash.py
337
+ Restart=no
338
+
339
+ [Install]
340
+ WantedBy=sysinit.target
336
341
EOF
337
342
sudo systemctl enable squishbox.service
338
- sed -i " /^HW_VERSION/s|[v0-9]\+| $hw_version | " $installdir /squishbox.py
343
+ sudo systemctl enable lcdsplash.service
339
344
ASK_TO_REBOOT=true
345
+
340
346
elif [[ $installtype == 2 ]]; then
341
347
inform " Enabling Headless Pi Synth startup service..."
342
348
chmod a+x $installdir /headlesspi.py
349
+ sed -i " /^CHAN/s|[0-9]\+|$ctrls_channel |" $installdir /headlesspi.py
350
+ sed -i " /^DEC_PATCH/s|[0-9]\+|$decpatch |" $installdir /headlesspi.py
351
+ sed -i " /^INC_PATCH/s|[0-9]\+|$incpatch |" $installdir /headlesspi.py
352
+ sed -i " /^BANK_INC/s|[0-9]\+|$bankinc |" $installdir /headlesspi.py
343
353
cat << EOF | sudo tee /etc/systemd/system/squishbox.service
344
354
[Unit]
345
355
Description=Headless Pi Synth
@@ -356,10 +366,6 @@ Restart=on-failure
356
366
WantedBy=multi-user.target
357
367
EOF
358
368
sudo systemctl enable squishbox.service
359
- sed -i " /^CHAN/s|[0-9]\+|$ctrls_channel |" $installdir /headlesspi.py
360
- sed -i " /^DEC_PATCH/s|[0-9]\+|$decpatch |" $installdir /headlesspi.py
361
- sed -i " /^INC_PATCH/s|[0-9]\+|$incpatch |" $installdir /headlesspi.py
362
- sed -i " /^BANK_INC/s|[0-9]\+|$bankinc |" $installdir /headlesspi.py
363
369
ASK_TO_REBOOT=true
364
370
fi
365
371
407
413
sed -i " 0,/root_path =/s|root_path = .*|root_path = '$installdir /SquishBox';|" tinyfilemanager.php
408
414
sed -i " 0,/favicon_path =/s|favicon_path = .*|favicon_path = 'gfl_logo.png';|" tinyfilemanager.php
409
415
sudo mv -f tinyfilemanager.php /var/www/html/index.php
410
- wget -q https://geekfunklabs.com/gfl_logo.png
411
- sudo mv -f gfl_logo.png /var/www/html/
416
+ sudo cp -f assets/gfl_logo.png /var/www/html/
412
417
ASK_TO_REBOOT=true
413
418
fi
414
419
0 commit comments