#!/bin/bash

if [ -e /dev/mtd7 ]; then
	ubiattach -p /dev/mtd7
	mkdir -p /mnt/config
	mount -t ubifs ubi0:reserve2 /mnt/config
	echo "	hwaddress ether `cat /mnt/config/mac_addr`" >> /etc/network/interfaces
	umount /mnt/config
	rm -r /mnt/config
	ubidetach -p /dev/mtd7
	rm /etc/network/if-pre-up.d/set-mac
fi
