hostname and nfsboot

Here is the script I use to set the host name of a nfsboot client. On Debian it should be set as /etc/init.d/hostname.sh.

#! /bin/sh -x
ETH=eth1

IP=$(ifconfig $ETH | head -n2 | tail -n1 | sed 's/:/ /g' | awk '{ print $3 }')
HN=$(cat /etc/hosts | grep $IP | awk '{ print $2 }')
hostname $HN

If hostname is not propertly set one symptom is that rpc.statd doe’s not start (see man rpc.statd, -n option, to know why).

#network