#!/bin/sh -e

		if [ `whoami` != "root" ]; then
			echo "You must run this as root."
			echo "sudo $0"
			exit 0
		fi

rm /etc/hostname

    if [ ! -e "/etc/hostname" ]; then
        mac=`cat /sys/class/net/eth*/address | sed s/://g`
        hostname="odrobian-$mac"
#       log_action_begin_msg "Creating /etc/hostname with $hostname"
#       mount -n -o remount,rw / || echo "Remounting / rw failed"
        echo "$hostname" > /etc/hostname
        hostname "$hostname"
        if ! grep "^127.0.0.1\s*$hostname\s*" /etc/hosts > /dev/null ; then
            sed -i "1i 127.0.0.1\\t$hostname" /etc/hosts
        fi
#       sync || echo "sync failed"
#       mount -n -o remount,ro / || echo "Remounting / ro failed"
#        log_action_end_msg 0
    fi

reboot
