#!/bin/sh

# initramfs startup script

# -------------------------------------------------------------
# Find out how large our root filesystem is
# and limit the root tmpfs in size.
setHostname(){
	HOSTNAME="pilab-$(vcgencmd otp_dump | grep 28: | sed s/.*://g)"
	echo ${HOSTNAME} > /etc/hostname
	if grep -q '127.0.1.1' /etc/hosts; then
		sed -i "s/127.0.1.1.*/127.0.1.1 $HOSTNAME/g" /etc/hosts
	else
		echo "127.0.1.1 ${HOSTNAME}" >> /etc/hosts
	fi
}

echo
echo "Start Init"

setHostname

exec /sbin/init
