From 09728d1c825996e39dae30e1d10b39d9fc11e651 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 26 Mar 2019 12:52:07 +0900 Subject: [PATCH] allow installation in qemu Currently, installation is only supported on real hardware, but not running in QEMU. Change the check to make sure the necessary directories and programs are available instead of bailing out on non-Raspberry archs. --- install.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 380512e..7461204 100755 --- a/install.sh +++ b/install.sh @@ -5,9 +5,26 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -is_Raspberry=$(cat /proc/device-tree/model | awk '{print $1}') -if [ "x${is_Raspberry}" != "xRaspberry" ] ; then - echo "Sorry, this drivers only works on raspberry pi" +# +# make sure that we are on something ARM/Raspberry related +# either a bare metal Raspberry or a qemu session with +# Raspberry stuff available +# - check for /boot/overlays +# - dtparam and dtoverlay is available +errorFound=0 +if [ ! -d /boot/overlays ] ; then + echo "/boot/overlays not found or not a directory" 1>&2 + errorFound=1 +fi +# should we also check for alsactl and amixer used in seeed-voicecard? +for cmd in dtparam dtoverlay ; do + if ! which $cmd &>/dev/null ; then + echo "$cmd not found" 1>&2 + errorFound=1 + fi +done +if [ $errorFound = 1 ] ; then + echo "Errors found, exiting." 1>&2 exit 1 fi