#!/bin/sh

MAC=`ifconfig | grep HWaddr | awk '{print $5}'`
echo "mac: $MAC"
echo -ne " mac_addr=$MAC" >> /boot/uEnv.txt

IP=`ifconfig eth0 | grep "inet addr" | awk '{print $2}' | tr -d "addr:"`
echo "ip: $IP"

NUM=`echo $IP | awk -F. '{print $4}'`
echo "num: $NUM"
echo "cubie$NUM" > /etc/hostname
hostname "cubie$NUM"

cat > /etc/hosts << EOF
127.0.0.1 localhost cubie$NUM
EOF

#cat > /etc/network/interfaces << EOF
#auto lo
#iface lo inet loopback
#
#auto eth0
#iface eth0 inet static
#address $IP
#netmask 255.255.255.0
#network 192.168.1.0
#broadcast 192.168.1.255
#gateway 192.168.1.1
#EOF
