[openwrt] move sensor config loading at firstboot to flukso init script
This commit is contained in:
parent
90f4f8be8c
commit
cf45925c44
|
@ -4,6 +4,7 @@ config system
|
||||||
option device 0123456789abcdef0123456789abcdef
|
option device 0123456789abcdef0123456789abcdef
|
||||||
option key 00112233445566778899aabbccddeeff
|
option key 00112233445566778899aabbccddeeff
|
||||||
option version 210
|
option version 210
|
||||||
|
option firstboot 1
|
||||||
|
|
||||||
config button
|
config button
|
||||||
option button reset
|
option button reset
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Copyright (C) 2006-2010 OpenWrt.org
|
|
||||||
# Copyright (C) 2010 Vertical Communications
|
|
||||||
# Copyright (C) 2011 flukso.net
|
|
||||||
|
|
||||||
flukso_config() {
|
|
||||||
uci set system.@system[0].key=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11000)) -n 16 /dev/mtd6)
|
|
||||||
uci set system.@system[0].device=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 16 /dev/mtd6)
|
|
||||||
uci set system.@system[0].hostname=flukso-$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 3 /dev/mtd6)
|
|
||||||
|
|
||||||
for i in `seq 6`;
|
|
||||||
do
|
|
||||||
ADDRESS=0x110$((i+2))0
|
|
||||||
uci set flukso.$i.id=$(hexdump -v -e '1/1 "%.2x"' -s $((ADDRESS)) -n 16 /dev/mtd6)
|
|
||||||
done
|
|
||||||
|
|
||||||
uci commit
|
|
||||||
|
|
||||||
echo 'configuring flukso device and sensor ids'
|
|
||||||
}
|
|
||||||
|
|
||||||
boot_hook_add switch2jffs flukso_config
|
|
|
@ -3,14 +3,42 @@
|
||||||
|
|
||||||
START=98
|
START=98
|
||||||
|
|
||||||
start() {
|
load_config()
|
||||||
|
{
|
||||||
|
uci set system.@system[0].key=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11000)) -n 16 /dev/mtd6)
|
||||||
|
uci set system.@system[0].device=$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 16 /dev/mtd6)
|
||||||
|
uci set system.@system[0].hostname=flukso-$(hexdump -v -e '1/1 "%.2x"' -s $((0x11020)) -n 3 /dev/mtd6)
|
||||||
|
|
||||||
|
for i in `seq 6`;
|
||||||
|
do
|
||||||
|
ADDRESS=0x110$((i+2))0
|
||||||
|
uci set flukso.$i.id=$(hexdump -v -e '1/1 "%.2x"' -s $((ADDRESS)) -n 16 /dev/mtd6)
|
||||||
|
done
|
||||||
|
|
||||||
|
uci set system.@system[0].firstboot='0'
|
||||||
|
uci commit
|
||||||
|
|
||||||
|
logger 'configuring flukso device and sensor ids'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
FIRSTBOOT=$(uci get system.@system[0].firstboot)
|
||||||
|
|
||||||
|
if [ $FIRSTBOOT -eq '1' ]
|
||||||
|
then
|
||||||
|
load_config
|
||||||
|
fi
|
||||||
|
|
||||||
chmod 666 /dev/spidev0.0
|
chmod 666 /dev/spidev0.0
|
||||||
|
|
||||||
/usr/sbin/spid
|
/usr/sbin/spid
|
||||||
/usr/sbin/fluksod
|
/usr/sbin/fluksod
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop()
|
||||||
|
{
|
||||||
/usr/sbin/fluksod -k
|
/usr/sbin/fluksod -k
|
||||||
/usr/sbin/spid -k
|
/usr/sbin/spid -k
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue