blob: 3494985d3fc33dfcb6ed0b74b9b5d74368ba10b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/sh
#
# Petitboot udhcpc user script. Should be run by udhcpc when
# there is a change in the dhcp configuration. For more info
# see the udhcpc man page and the Linux kernel source file
# Documentation/filesystems/nfsroot.txt.
#
PBOOT_USER_EVENT_SOCKET="/tmp/petitboot.ev"
log="/var/log/petitboot/pb-udhcpc.log"
pb_add () {
# Looks like udhcpc will give us different names, depending if the
# parameter was in the header, or specified by options
[ -z "$bootfile" ] && bootfile=${boot_file}
mac=$(< /sys/class/net/$interface/address)
paramstr=''
# Collect relevant DHCP response parameters into $paramstr
for name in conffile bootfile mac ip siaddr serverid tftp
do
value=$(eval "echo \${$name}")
[ -n "$value" ] || continue;
paramstr="$paramstr $name=$value"
done
pb-event dhcp@{interface} $paramstr
# Check if an explicit config file present
if [ -n "${conffile}" ]
then
return;
fi
# Finally, add an option for the boot_file parameter
paramstr='name=netboot'
# Collect relevant parameters to add an option to the boot_file parameter
for name in rootpath siaddr boot_file
do
value=$(eval "echo \${$name}")
[ -n "$value" ] || continue;
paramstr="$paramstr $name=$value"
done
pb-event add@{interface} $paramstr
}
pb_remove () {
pb-event remove@${interface} name=netboot
}
case "$1" in
bound)
pb_add
;;
deconfig)
pb_remove
;;
*)
;;
esac
printf "--- $1 ---\n" >> ${log}
set >> ${log}
printf "---------------\n" >> ${log}
|