@@ -82,17 +82,6 @@ apt_pkg_install() {
8282 fi
8383}
8484
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-
9685
9786sleep 1 # give curl time to print info
9887
@@ -122,7 +111,7 @@ https://github.com/GeekFunkLabs/fluidpatcher
122111Report issues with this script at
123112https://github.com/GeekFunkLabs/fluidpatcher/issues
124113
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 ].
126115Setup will begin after all questions are answered.
127116"
128117
@@ -131,12 +120,13 @@ if test -f /etc/os-release; then
131120 if ! { grep -q ^Raspberry /proc/device-tree/model; } then
132121 ENVCHECK=false
133122 fi
134- if ! { grep -q bullseye /etc/os-release; } then
123+ if ! { grep -q " bullseye\|bookworm " /etc/os-release; } then
135124 ENVCHECK=false
136125 fi
137126fi
138127if ! ($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,"
140130 warning " which does not appear to be the situation here. YMMV!"
141131 if noyes " Proceed anyway?" ; then
142132 exit 1
@@ -153,16 +143,21 @@ if [[ $installtype == 1 ]]; then
153143 inform " This script must reboot your computer to activate your sound card."
154144 inform " Once this is complete, run this script again to continue setup."
155145 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
157151 sync; sudo reboot
152+ exit 0
158153 fi
159154 fi
160155 echo " What version of SquishBox hardware are you using?"
161156 echo " v6 - Green PCB with SMT components"
162157 echo " v4 - Purple PCB, has 2 resistors and LED"
163158 echo " v3 - Purple PCB, has 1 resistor"
164159 echo " v2 - Hackaday/perfboard build"
165- query " Choose " " v6" ; hw_version=$response
160+ query " Enter version code " " v6" ; hw_version=$response
166161elif [[ $installtype == 2 ]]; then
167162 echo " Set up controls for Headless Pi Synth:"
168163 query " MIDI channel for controls" " 1" ; ctrls_channel=$response
@@ -233,22 +228,18 @@ if [[ $install_synth ]]; then
233228 # get dependencies
234229 inform " Installing/Updating supporting software..."
235230 sysupdate
236- apt_pkg_install " python3-pip"
231+ apt_pkg_install " python3-yaml"
232+ apt_pkg_install " python3-rpi.gpio"
237233 apt_pkg_install " fluid-soundfont-gm"
238234 apt_pkg_install " ladspa-sdk" optional
239235 apt_pkg_install " swh-plugins" optional
240236 apt_pkg_install " tap-plugins" optional
241237 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
247238
248239 # 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
252243 inform " Installing/Updating FluidPatcher version $NEW_FP_VER ..."
253244 wget -qO - https://github.com/GeekFunkLabs/fluidpatcher/tarball/master | tar -xzm
254245 fptemp=` ls -dt GeekFunkLabs-fluidpatcher-* | head -n1`
@@ -265,12 +256,9 @@ if [[ $install_synth ]]; then
265256 fi
266257
267258 # 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
274262 inform " Compiling latest FluidSynth from source..."
275263 echo " Getting build dependencies..."
276264 if { grep -q ^# deb-src /etc/apt/sources.list; } then
@@ -282,10 +270,8 @@ if [[ $install_synth ]]; then
282270 || echo E: install failed; } | grep ' ^[WE]:' ; then
283271 warning " Couldn't get all dependencies!"
284272 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`
289275 mkdir $fstemp /build
290276 cd $fstemp /build
291277 echo " Configuring..."
@@ -295,7 +281,7 @@ if [[ $install_synth ]]; then
295281 if { sudo make install; } then
296282 sudo ldconfig
297283 else
298- warning " Unable to compile FluidSynth $BUILD_VER "
284+ warning " Unable to compile FluidSynth $BUILD_VER - installing from package repository "
299285 apt_pkg_install " fluidsynth"
300286 fi
301287 cd ../..
319305if [[ $installtype == 1 ]]; then
320306 inform " Enabling SquishBox startup service..."
321307 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
322314 cat << EOF | sudo tee /etc/systemd/system/squishbox.service
323315[Unit]
324316Description=SquishBox
@@ -333,13 +325,31 @@ Restart=on-failure
333325
334326[Install]
335327WantedBy=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
336341EOF
337342 sudo systemctl enable squishbox.service
338- sed -i " /^HW_VERSION/s|[v0-9]\+| $hw_version | " $installdir /squishbox.py
343+ sudo systemctl enable lcdsplash.service
339344 ASK_TO_REBOOT=true
345+
340346elif [[ $installtype == 2 ]]; then
341347 inform " Enabling Headless Pi Synth startup service..."
342348 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
343353 cat << EOF | sudo tee /etc/systemd/system/squishbox.service
344354[Unit]
345355Description=Headless Pi Synth
@@ -356,10 +366,6 @@ Restart=on-failure
356366WantedBy=multi-user.target
357367EOF
358368 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
363369 ASK_TO_REBOOT=true
364370fi
365371
407413 sed -i " 0,/root_path =/s|root_path = .*|root_path = '$installdir /SquishBox';|" tinyfilemanager.php
408414 sed -i " 0,/favicon_path =/s|favicon_path = .*|favicon_path = 'gfl_logo.png';|" tinyfilemanager.php
409415 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/
412417 ASK_TO_REBOOT=true
413418fi
414419
0 commit comments