All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory
@ 2012-05-15 14:22 George Dunlap
  2012-05-15 14:22 ` [PATCH 1 of 3 v3] libxl: Look for bootloader in libexec path George Dunlap
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: George Dunlap @ 2012-05-15 14:22 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

tools: Move bootloaders to libexec directory

pygrub and xenpvnetboot are meant to be run by tools, and not by the user,
and thus should be in /usr/lib/xen/bin rather than /usr/bin.  This patch
series:
* Causes libxl to look in the libexec dir if a full path is not specified,
  falling back to searching PATH if it's not in the libexec dir
* Moves pygrub and xenpvnetboot into the libexec dir
* For compatibility with existing configs, puts a link to pygrub in /usr/bin
* Warns the user that /usr/bin/pygrub is deprecated

v2: 
 - If the bootloader is not in the libexec path, revert to using the string
   as passed in the config file (which will search $PATH)
 - Use strcmp rather than strncmp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1 of 3 v3] libxl: Look for bootloader in libexec path
  2012-05-15 14:22 [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory George Dunlap
@ 2012-05-15 14:22 ` George Dunlap
  2012-05-15 14:22 ` [PATCH 2 of 3 v3] tools: Install pv bootloaders in libexec rather than /usr/bin George Dunlap
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2012-05-15 14:22 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

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.

v2:
 - Check for the libexec path, and if the bootloader isn't there, fall back to
   the explicitly passed value.  If the full path isn't specified, this will
   case execvp to search using the path given in the PATH variable.

v3:
 - Port to xen-unstable tip
 - Take out now-unnecessary check for malloc failure

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

diff -r edd7c7ad1ad2 -r 52ff381a0bba tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Tue May 15 09:18:33 2012 +0200
+++ b/tools/libxl/libxl_bootloader.c	Tue May 15 15:13:36 2012 +0100
@@ -336,6 +336,26 @@ void libxl__bootloader_run(libxl__egc *e
         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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2 of 3 v3] tools: Install pv bootloaders in libexec rather than /usr/bin
  2012-05-15 14:22 [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory George Dunlap
  2012-05-15 14:22 ` [PATCH 1 of 3 v3] libxl: Look for bootloader in libexec path George Dunlap
@ 2012-05-15 14:22 ` George Dunlap
  2012-05-15 14:22 ` [PATCH 3 of 3 v3] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap
  2012-05-15 15:29 ` [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory Ian Campbell
  3 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2012-05-15 14:22 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

pygrub and xenpvnetboot are meant to be run by tools, and not by the user,
and thus should be in /usr/lib/xen/bin rather than /usr/bin.

Because most config files will still have an absolute path pointing to
/usr/bin/pygrub, make a symbolic link that we will deprecate.

Signed-off-by: George Dunlap <george.dunlap@eu.ctirix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

diff -r 52ff381a0bba -r 9ebf2c1292c3 tools/misc/Makefile
--- a/tools/misc/Makefile	Tue May 15 15:13:36 2012 +0100
+++ b/tools/misc/Makefile	Tue May 15 15:13:45 2012 +0100
@@ -18,7 +18,7 @@ SUBDIRS-$(CONFIG_LOMOUNT) += lomount
 SUBDIRS-$(CONFIG_MINITERM) += miniterm
 SUBDIRS := $(SUBDIRS-y)
 
-INSTALL_BIN-y := xencons xenpvnetboot
+INSTALL_BIN-y := xencons
 INSTALL_BIN-$(CONFIG_X86) += xen-detect
 INSTALL_BIN := $(INSTALL_BIN-y)
 
@@ -27,6 +27,9 @@ INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx
 INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
 INSTALL_SBIN := $(INSTALL_SBIN-y)
 
+INSTALL_PRIVBIN-y := xenpvnetboot
+INSTALL_PRIVBIN := $(INSTALL_PRIVBIN-y)
+
 # Include configure output (config.h) to headers search path
 CFLAGS += -I$(XEN_ROOT)/tools
 
@@ -41,8 +44,10 @@ build: $(TARGETS)
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR)
+	$(INSTALL_PYTHON_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(PRIVATE_BINDIR)
 	set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done
 
 .PHONY: clean
diff -r 52ff381a0bba -r 9ebf2c1292c3 tools/pygrub/Makefile
--- a/tools/pygrub/Makefile	Tue May 15 15:13:36 2012 +0100
+++ b/tools/pygrub/Makefile	Tue May 15 15:13:45 2012 +0100
@@ -11,9 +11,11 @@ build:
 .PHONY: install
 install: all
 	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
-	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(BINDIR)/pygrub
+		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \
+		--install-scripts=$(DESTDIR)/$(PRIVATE_BINDIR) --force
+	$(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub
 	$(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot
+	ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR)
 
 .PHONY: clean
 clean:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3 of 3 v3] libxl: Warn that /usr/bin/pygrub is deprecated
  2012-05-15 14:22 [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory George Dunlap
  2012-05-15 14:22 ` [PATCH 1 of 3 v3] libxl: Look for bootloader in libexec path George Dunlap
  2012-05-15 14:22 ` [PATCH 2 of 3 v3] tools: Install pv bootloaders in libexec rather than /usr/bin George Dunlap
@ 2012-05-15 14:22 ` George Dunlap
  2012-05-15 15:29 ` [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory Ian Campbell
  3 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2012-05-15 14:22 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap

v2: Use strcmp rather than strncmp.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

diff -r 9ebf2c1292c3 -r 804eb2962984 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Tue May 15 15:13:45 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c	Tue May 15 15:13:45 2012 +0100
@@ -338,6 +338,10 @@ void libxl__bootloader_run(libxl__egc *e
 
     LOG(DEBUG, "Config bootloader value: %s", info->u.pv.bootloader);
 
+    if ( !strcmp(info->u.pv.bootloader, "/usr/bin/pygrub") )
+        LOG(WARN, "bootloader='/usr/bin/pygrub' is deprecated; use " \
+            "bootloader='pygrub' instead");
+    
     /* If the full path is not specified, check in the libexec path */
     if ( info->u.pv.bootloader[0] != '/' ) {
         char *bootloader;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory
  2012-05-15 14:22 [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory George Dunlap
                   ` (2 preceding siblings ...)
  2012-05-15 14:22 ` [PATCH 3 of 3 v3] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap
@ 2012-05-15 15:29 ` Ian Campbell
  3 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2012-05-15 15:29 UTC (permalink / raw)
  To: George Dunlap; +Cc: xen-devel@lists.xensource.com

On Tue, 2012-05-15 at 15:22 +0100, George Dunlap wrote:
> tools: Move bootloaders to libexec directory
> 
> pygrub and xenpvnetboot are meant to be run by tools, and not by the user,
> and thus should be in /usr/lib/xen/bin rather than /usr/bin.  This patch
> series:
> * Causes libxl to look in the libexec dir if a full path is not specified,
>   falling back to searching PATH if it's not in the libexec dir
> * Moves pygrub and xenpvnetboot into the libexec dir
> * For compatibility with existing configs, puts a link to pygrub in /usr/bin
> * Warns the user that /usr/bin/pygrub is deprecated
> 
> v2: 
>  - If the bootloader is not in the libexec path, revert to using the string
>    as passed in the config file (which will search $PATH)
>  - Use strcmp rather than strncmp

All 3 patches:
Committed-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-15 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15 14:22 [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory George Dunlap
2012-05-15 14:22 ` [PATCH 1 of 3 v3] libxl: Look for bootloader in libexec path George Dunlap
2012-05-15 14:22 ` [PATCH 2 of 3 v3] tools: Install pv bootloaders in libexec rather than /usr/bin George Dunlap
2012-05-15 14:22 ` [PATCH 3 of 3 v3] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap
2012-05-15 15:29 ` [PATCH 0 of 3 v3] tools: Move bootloaders to libexec directory Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.