-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,13 +74,12 @@ dpkg-reconfigure tzdata | |
# Enable 1Wire en I2C during boot | ||
if [ -f /boot/config.txt ]; then | ||
|
||
if [ `grep -ic "#dtparam=i2c_arm=on" /boot/config.txt` -eq 1 ]; then | ||
sed -i.bak 's/^#dtparam=i2c_arm=on/dtparam=i2c_arm=on/' /boot/config.txt | ||
fi | ||
# Enable I2C | ||
if [ `grep -ic "dtparam=i2c_arm=on" /boot/config.txt` -eq 0 ]; then | ||
echo "dtparam=i2c_arm=on" >> /boot/config.txt | ||
fi | ||
|
||
# Enable 1-Wire | ||
if [ `grep -ic "dtoverlay=w1-gpio" /boot/config.txt` -eq 0 ]; then | ||
echo "dtoverlay=w1-gpio" >> /boot/config.txt | ||
fi | ||
|
@@ -90,6 +89,17 @@ if [ -f /boot/config.txt ]; then | |
echo "gpu_mem=128" >> /boot/config.txt | ||
fi | ||
|
||
# Enable serial | ||
if [ `grep -ic "enable_uart=1" /boot/config.txt` -eq 0 ]; then | ||
echo "enable_uart=1" >> /boot/config.txt | ||
fi | ||
|
||
# Make TerrariumPI start during boot | ||
if [ `grep -ic "start.sh" /etc/rc.local` -eq 0 ]; then | ||
sed -i.bak "s@^exit 0@# Starting TerrariumPI server\n${BASEDIR}/start.sh\n\nexit 0@" /etc/rc.local | ||
fi | ||
|
||
|
||
fi | ||
|
||
# Create needed groups | ||
|
@@ -136,6 +146,12 @@ fi | |
|
||
# Make sure pigpiod is started at boot, and that user PI can restart it with sudo command | ||
echo "${SCRIPT_USER} ALL=(ALL) NOPASSWD: /usr/sbin/service pigpiod restart" > /etc/sudoers.d/terrariumpi | ||
# https://github.com/UedaTakeyuki/mh-z19/blob/master/pypi/mh_z19/__init__.py#L18 | ||
echo "${SCRIPT_USER} ALL=(ALL) NOPASSWD: /bin/systemctl stop [email protected]" >> /etc/sudoers.d/terrariumpi | ||
echo "${SCRIPT_USER} ALL=(ALL) NOPASSWD: /bin/systemctl start [email protected]" >> /etc/sudoers.d/terrariumpi | ||
echo "${SCRIPT_USER} ALL=(ALL) NOPASSWD: /bin/systemctl stop [email protected]" >> /etc/sudoers.d/terrariumpi | ||
echo "${SCRIPT_USER} ALL=(ALL) NOPASSWD: /bin/systemctl start [email protected]" >> /etc/sudoers.d/terrariumpi | ||
|
||
systemctl enable pigpiod | ||
|
||
# Remove unneeded OWS services | ||
|
@@ -174,7 +190,7 @@ EOF | |
git submodule update > /dev/null | ||
cd "${BASEDIR}/.." | ||
|
||
PIP_MODULES="python-dateutil rpi.gpio psutil picamera pigpio requests gpiozero gevent untangle uptime bottle bottle_websocket pylibftdi pyalsaaudio pyserial python-twitter python-pushover requests[socks] Adafruit_DHT Adafruit_SHT31 luma.oled bluepy pywemo pyownet emails" | ||
PIP_MODULES="python-dateutil rpi.gpio psutil picamera pigpio requests gpiozero gevent untangle uptime bottle bottle_websocket pylibftdi pyalsaaudio pyserial python-twitter python-pushover requests[socks] Adafruit_DHT Adafruit_SHT31 luma.oled bluepy pywemo pyownet emails mh-z19" | ||
if [ $PYTHON -eq 3 ]; then | ||
PIP_MODULES="${PIP_MODULES} opencv-python-headless" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters