From 29b703949f84574e2af86216fa0ed3d27248897e Mon Sep 17 00:00:00 2001
From: tobiglaser <76131623+tobiglaser@users.noreply.github.com>
Date: Thu, 25 Aug 2022 21:14:44 +0200
Subject: [PATCH] "fix" missing i2c driver + add ip info

---
 setup.sh | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/setup.sh b/setup.sh
index f363ea2..4266e2b 100755
--- a/setup.sh
+++ b/setup.sh
@@ -126,7 +126,14 @@
 		if [ $I2C -eq 1 ] # if I2C is off
 		then
 			echo " Turning on I2C."
-			sudo raspi-config nonint do_i2c 0
+			a=$(sudo raspi-config nonint do_i2c 0)
+			# if the i2c driver was updated a reboot is necessary.
+			# "modprobe: FATAL: Module i2c-dev not found in directory /lib/modules/5.15.32-v7l+"
+			if echo $a | grep -i 'modprobe\|FATAL\|not found' > /dev/null
+			then
+				pleaseReboot=true
+			fi
+
 		else
 			echo " I2C is active."
 			break
@@ -162,6 +169,18 @@
 		sudo cp -r Arduino/* /home/$vncBaseName$i/Arduino/
 	done
 
+#display useful info
+	echo "Setup complete."
+	echo ""
+	echo "Hostname:  $(hostname)"
+	echo "IP-Adress: $(hostname -I | awk '{print $1}')"
+
+#display reboot message if necessary
+	if [ "{$pleaseReboot}" == "true"]
+	then
+		echo "PLEASE REBOOT"
+	fi
+
 
 # Camera Stuff...
 #python3 -m pip install --upgrade --force-reinstall Pillow
-- 
GitLab