-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrc.local
More file actions
executable file
·44 lines (39 loc) · 1.14 KB
/
Copy pathrc.local
File metadata and controls
executable file
·44 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
awk '/^Revision/{if(length($3)<=5){r=$3}else{r=substr($3,length($3)-5)};if(0+("0x"r)>=4){exit 1}else{exit 0}}' /proc/cpuinfo
if [ "$?" = "0" ] ; then # Test if this Raspberry Pi is revision 1 hardware. Set useful vars for script processing.
i2c=0 ; rev=1
else
i2c=1 ; rev=2
fi
export i2c rev
( # Start LCD menu if fitted or STFX directly
cd /home/pi/stfx/
# detect MCP23017 on std bus first then later work out if it's deffo LCD
if /usr/local/bin/i2cdetectany.sh 20 $i2c ; then
./lcdmenu.py >/dev/null 2>/dev/null
else
./stfx.sh >/dev/null 2>/dev/null
fi
) &
if /usr/local/bin/i2cdetectany.sh 68 ; then # Test if RTC hardware is connected.
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-${i2c}/new_device
hwclock -s
fi
true