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=$(< /sys/class/net/$interface/address)
20 # Collect relevant DHCP response parameters into $paramstr
21 for name in pxeconffile bootfile mac ip siaddr serverid tftp
23 value=$(eval "echo \${$name}")
24 [ -n "$value" ] || continue;
26 paramstr="$paramstr $name=$value"
29 pb-event dhcp@{interface} $paramstr
31 # Check if an explicit config file present
32 if [ -n "${conffile}" ]
37 # Finally, add an option for the boot_file parameter
38 paramstr='name=netboot'
40 # Collect relevant parameters to add an option to the boot_file parameter
41 for name in rootpath siaddr boot_file
43 value=$(eval "echo \${$name}")
44 [ -n "$value" ] || continue;
46 paramstr="$paramstr $name=$value"
49 pb-event add@{interface} $paramstr
53 pb-event remove@${interface} name=netboot
67 printf "--- $1 ---\n" >> ${log}
69 printf "---------------\n" >> ${log}