Merge pull request #401 from akuker/rdmark_fix_i2c_config

Use raspi-config to manage the boot config
This commit is contained in:
Eric Helgeson 2021-10-28 18:32:46 -05:00 committed by GitHub
commit 8c2ce8f440
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ function installRaScsiScreen() {
stopRaScsiScreen
updateRaScsiGit
sudo apt-get update && sudo apt-get install python3-dev python3-pip python3-venv libjpeg-dev libpng-dev libopenjp2-7-dev i2c-tools -y </dev/null
sudo apt-get update && sudo apt-get install python3-dev python3-pip python3-venv libjpeg-dev libpng-dev libopenjp2-7-dev i2c-tools raspi-config -y </dev/null
if [ -f "$BASE/src/oled_monitor/rascsi_interface_pb2.py" ]; then
rm "$BASE/src/oled_monitor/rascsi_interface_pb2.py"
@ -169,14 +169,10 @@ function installRaScsiScreen() {
if [[ $(grep -c "^dtparam=i2c_arm=on" /boot/config.txt) -ge 1 ]]; then
echo "NOTE: I2C support seems to have been configured already."
REBOOT=0
elif [[ $(grep -c "^dtparam=i2c_arm=off" /boot/config.txt) -ge 1 ]]; then
echo "NOTE: I2C support seems to have been disabled; We will override that configuration in /boot/config.txt"
sudo sed -i /^dtparam=i2c_arm/d /boot/config.txt
sudo bash -c 'echo "dtparam=i2c_arm=on" >> /boot/config.txt'
REBOOT=1
else
sudo bash -c 'echo "dtparam=i2c_arm=on" >> /boot/config.txt'
echo "Modified /boot/config.txt"
sudo raspi-config nonint do_i2c 0 </dev/null
echo "Modified the Raspberry Pi boot configuration to enable I2C."
echo "A reboot will be required for the change to take effect."
REBOOT=1
fi