3 # Petitboot udhcpc user script. Should be run by udhcpc when
4 # there is a change in the dhcp configuration. For more info
5 # see the udhcpc man page and the Linux kernel source file
6 # Documentation/filesystems/nfsroot.txt.
9 PBOOT_USER_EVENT_SOCKET="/tmp/petitboot.ev"
10 log="/var/log/petitboot/pb-udhcpc.log"
13 # Looks like udhcpc will give us different names, depending if the
14 # parameter was in the header, or specified by options
15 [ -z "$bootfile" ] && bootfile=${boot_file}
17 mac=$(cat /sys/class/net/$interface/address)
20 # Collect relevant DHCP response parameters into $paramstr
21 for name in pxeconffile pxepathprefix reboottime bootfile mac ip \
24 value=$(eval "echo \${$name}")
25 [ -n "$value" ] || continue;
27 paramstr="$paramstr $name=$value"
30 pb-event dhcp@${interface} $paramstr
32 # Check if an explicit boot file present. If there is, add it as
34 if [ -z "${bootfile}" ]
41 # Collect relevant parameters to add an option to the bootfile
43 for name in rootpath siaddr bootfile mac
45 value=$(eval "echo \${$name}")
46 [ -n "$value" ] || continue;
48 paramstr="$paramstr $name=$value"
51 pb-event add@${interface} name="netboot $interface ($bootfile)" \
56 mac=$(cat /sys/class/net/$interface/address)
57 pb-event remove@${interface} mac=$mac
71 printf "--- $1 ---\n" >> ${log}
73 printf "---------------\n" >> ${log}