diff options
author | Geoff Levand <geoffrey.levand@am.sony.com> | 2009-04-12 15:11:56 +0000 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-06-30 15:29:24 +0800 |
commit | 24990ffe86e0fa80dff2da365541ae67e427c57a (patch) | |
tree | 1dc3154553292f76fb345087dd4388184a4a79ca /utils | |
parent | cf3593ef4be341aace4843148a7999c5660e8b2b (diff) | |
download | talos-petitboot-24990ffe86e0fa80dff2da365541ae67e427c57a.tar.gz talos-petitboot-24990ffe86e0fa80dff2da365541ae67e427c57a.zip |
Add udhcpc utility script
Add a udhcpc utility script. udhcpc can be configured to run a
specified script when there is a change in the dhcp configuration.
This udhcpc utility script will write a petitboot netboot message
to the petitboot user event socket.
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/udhcpc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/udhcpc b/utils/udhcpc new file mode 100644 index 0000000..bc0f759 --- /dev/null +++ b/utils/udhcpc @@ -0,0 +1,38 @@ +#!/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="pb-udhcpc.log" + +pb_add () { + k_server_ip=${rootpath%%:*} + k_root_dir=${rootpath#*:} + + [ ${k_server_ip} != ${rootpath} ] || k_server_ip=${serverid} + + echo -ne "add@/net/${interface}\0name=netboot\0image=tftp://${siaddr}${boot_file}\0args=root=/dev/nfs ip=any nfsroot=${k_server_ip}:${k_root_dir}\0" | pb-event +} + +pb_remove () { + echo -ne "remove@/net/${interface}\0name=netboot\0" | pb-event +} + +case "$1" in +bound | renew) + pb_add + ;; +deconfig) + pb_remove + ;; +*) + ;; +esac + +echo "--- $1 ---" >> ${log} +set >> ${log} +echo "---------------" >> ${log} |