X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/blobdiff_plain/651e1c201721a5903d0136d937c234166232c8e3..0c5111f2f7b09f9e24ff9165aa3ad7ae803fb6a7:/install.sh diff --git a/install.sh b/install.sh index 13ce97a..1136de8 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,11 @@ #!/bin/bash -printf "{{LIBNAME:UC}} Python Library: Installer\n\n" +LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'` +LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'` +CONFIG=/boot/config.txt +DATESTAMP=`date "+%Y-%M-%d-%H-%M-%S"` + +printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n" if [ $(id -u) -ne 0 ]; then printf "Script must be run as root. Try 'sudo ./install.sh'\n" @@ -19,4 +24,22 @@ fi cd .. +printf "Backing up $CONFIG\n" +cp $CONFIG "config.preinstall-$DATESTAMP.txt" + +printf "Setting up i2c and SPI..\n" +raspi-config nonint do_spi 0 +raspi-config nonint do_i2c 0 + +printf "Setting up serial for PMS5003..\n" +# Disable serial terminal over /dev/ttyAMA0 +raspi-config nonint do_serial 1 +# Enable serial port +raspi-config nonint set_config_var enable_uart 1 $CONFIG +# Switch serial port to full UART for stability (may adversely affect bluetooth) +sed -i 's/^#dtoverlay=pi3-miniuart-bt/dtoverlay=pi3-miniuart-bt/' $CONFIG +if ! grep -q -E "^dtoverlay=pi3-miniuart-bt" $CONFIG; then + printf "dtoverlay=pi3-miniuart-bt\n" >> $CONFIG +fi + printf "Done!\n"