diff options
author | George Dunlap <george.dunlap@eu.citrix.com> | 2012-05-15 16:28:10 +0100 |
---|---|---|
committer | George Dunlap <george.dunlap@eu.citrix.com> | 2012-05-15 16:28:10 +0100 |
commit | 965932f9fe938c408bcc3330a7db29fbab3964a8 (patch) | |
tree | 50ec9f87567f2556738a85cf2af955e79bfe9bcb /tools/libxl | |
parent | be6806f5677f42ed68e5c278823658c543c48ca6 (diff) | |
download | xen-965932f9fe938c408bcc3330a7db29fbab3964a8.tar.gz xen-965932f9fe938c408bcc3330a7db29fbab3964a8.tar.bz2 xen-965932f9fe938c408bcc3330a7db29fbab3964a8.zip |
libxl: Look for bootloader in libexec path
If the full path for a bootloader (such as pygrub or xenpvnetboot) is not
given, check for it first in the libexec path before falling back to the
PATH variable.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r-- | tools/libxl/libxl_bootloader.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c index fb1302b61b..d695ae0d27 100644 --- a/tools/libxl/libxl_bootloader.c +++ b/tools/libxl/libxl_bootloader.c @@ -336,6 +336,26 @@ void libxl__bootloader_run(libxl__egc *egc, libxl__bootloader_state *bl) goto out; } + LOG(DEBUG, "Config bootloader value: %s", info->u.pv.bootloader); + + /* If the full path is not specified, check in the libexec path */ + if ( info->u.pv.bootloader[0] != '/' ) { + char *bootloader; + struct stat st; + + bootloader = libxl__abs_path(gc, info->u.pv.bootloader, + libxl__libexec_path()); + /* Check to see if the file exists in this location; if not, + * fall back to checking the path */ + LOG(DEBUG, "Checking for bootloader in libexec path: %s", bootloader); + + if ( lstat(bootloader, &st) ) + LOG(DEBUG, "%s doesn't exist, falling back to config path", + bootloader); + else + info->u.pv.bootloader = bootloader; + } + make_bootloader_args(gc, bl); bl->openpty.ao = ao; |