Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from Tronde/develop
Browse files Browse the repository at this point in the history
resolves #16
  • Loading branch information
Tronde committed Feb 23, 2015
2 parents 729c64c + a0185ff commit 89b8054
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
7 changes: 6 additions & 1 deletion cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
apt-get -y --purge autoremove i2c-tools lighttpd php5-cgi bc

# I2C-Treiber deaktivieren
cp /etc/modprobe.d/raspi-blacklist.conf.bak /etc/modprobe.d/raspi-blacklist.conf
sed '/i2c-dev/d' /etc/modules >/etc/modules.tmp && mv /etc/modules.tmp /etc/modules
modprobe -r i2c_dev
# Nicht mehr benötigte Dateien aus älteren Versionen entfernen
if [ -e /etc/modprobe.d/raspi-blacklist.conf.bak ]
then
rm /etc/modprobe.d/raspi-blacklist.conf.bak
fi

# raspi-sht21.sh aus den runleveln und logrotate entfernen
update-rc.d -f raspi-sht21.sh remove
Expand Down
34 changes: 31 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,39 @@ function check() {
apt-get update && apt-get -y install i2c-tools lighttpd php5-cgi bc resolvconf
check $?

# Aktivierung der I2C Schnittstelle des Raspberry Pi
# Der Code wurde dem raspi-config Tool entnommen.
CONFIG=/boot/config.txt
SETTING=on
DEVICE_TREE="yes" # assume not disabled
DEFAULT=
if [ -e $CONFIG ] && grep -q "^device_tree=$" $CONFIG; then
DEVICE_TREE="no"
fi

CURRENT_SETTING="off" # assume disabled
DEFAULT=--defaultno
if [ -e $CONFIG ] && grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?(=(on|true|yes|1))?(,.*)?$" $CONFIG; then
CURRENT_SETTING="on"
DEFAULT=
fi
if [ $SETTING != $CURRENT_SETTING ]; then
echo "Die I2C-Schnittstelle wird beim nächsten Neustart aktiviert."
fi
sed $CONFIG -i -r -e "s/^((device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?)(=[^,]*)?/\1=$SETTING/"
if ! grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?=[^,]*" $CONFIG; then
printf "dtparam=i2c_arm=$SETTING\n" >> $CONFIG
fi
if [ $SETTING = "off" ]; then
return 0
fi

# I2C-Treiberaktivierung
echo "I2C-Treiberaktivierung"
echo "i2c-dev" >>/etc/modules
check $?
cp /etc/modprobe.d/raspi-blacklist.conf /etc/modprobe.d/raspi-blacklist.conf.bak
cp raspi-blacklist.conf /etc/modprobe.d/
modprobe i2c-dev
lsmod | grep i2c_dev
check $?
adduser pi i2c
check $?

Expand Down Expand Up @@ -60,4 +87,5 @@ check $?
# lighttpd zum Abschluss neustarten
service lighttpd restart
cd
echo "Bitte starten Sie den Raspberry Pi zum Abschluss der Installation einmal neu!"
exit 0
4 changes: 0 additions & 4 deletions raspi-blacklist.conf

This file was deleted.

0 comments on commit 89b8054

Please sign in to comment.