diff --git a/setup b/setup index 6da200a..cd48439 100755 --- a/setup +++ b/setup @@ -90,7 +90,8 @@ fi if [ $scriptAction == 'INSTALL' ] ; then updateActiveFile "$gpioListFile" updateActiveFile "$rulesFile" - updateActiveFile "$overlayFile" + # install overlay only if it doesn't exist + [ -f "$overlayFile" ] || updateActiveFile "$overlayFile" if [ $(grep -c "CAN+RS485 overlay" "$configFile") == 0 ]; then logMessage "activating CAN+RS485 DT overlay" @@ -98,6 +99,7 @@ if [ $scriptAction == 'INSTALL' ] ; then echo "dtparam=spi=on" >> "$configFile" echo "dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25,,spimaxfrequency=1000000" >> "$configFile" echo "dtoverlay=sc16is752-spi1,int_pin=24" >> "$configFile" + echo "gpio=16=ip,pu" >> "$configFile" echo "#### end CAN+RS485 overlay" >> "$configFile" filesUpdated=true fi @@ -107,13 +109,12 @@ fi # if an install step failed package needs to be removed if [ $scriptAction == 'UNINSTALL' ] ; then restoreActiveFile "$gpioListFile" - restoreActiveFile "$rulesFile" - # install overlay only if it doesn't exist - [ -f "$overlayFile" ] || restoreActiveFile "$overlayFile" + restoreActiveFile "$rulesFile" + restoreActiveFile "$overlayFile" # remove mods from configFile - do not use restore in case other mods were made manually if [ -f "$configFile" ]; then - if [ $(grep -c "#### change all digital inputs to pull ups" "$configFile") != 0 ]; then + if [ $(grep -c "#### begin CAN+RS485 overlay" "$configFile") != 0 ]; then sed -i -e '/#### begin CAN+RS485 overlay/,/#### end CAN+RS485 overlay/d' "$configFile" filesUpdated=true fi