[flukso] configure flukso device and sensor ids at firstboot

This commit is contained in:
Bart Van Der Meerssche 2011-03-10 20:29:17 +01:00
parent 70ce6fd748
commit 415bcdda48
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/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

View File

@ -55,6 +55,7 @@ config sensor 5
option enable 1
config sensor 6
option id 0123456789abcdef0123456789abcde6
option type uart
list port 6
option enable 1