flm01/mote/v2/openwrt/files/lib/firstboot/99_20_flukso_config

24 lines
685 B
Bash

#!/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