xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0 of 3] tools: Move bootloaders to libexec directory
@ 2012-04-26 14:26 George Dunlap
  2012-04-26 14:26 ` [PATCH 1 of 3] libxl: Look for bootloader in libexec path George Dunlap
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: George Dunlap @ 2012-04-26 14:26 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.  This patch 
series:
* Causes libxl to look in the libexec dir if a full path is not specified
* 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

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

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

If the full path for a bootloader (such as pygrub or xenpvnetboot) is not
given, look for it in the libexec path.

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

diff -r b4cbf273b1cb -r b810908dea7d tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Wed Feb 29 16:30:34 2012 +0000
+++ b/tools/libxl/libxl_bootloader.c	Thu Apr 26 15:09:35 2012 +0100
@@ -333,6 +333,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
 
     char tempdir_template[] = "/var/run/libxl/bl.XXXXXX";
     char *tempdir;
+    const char *bootloader = NULL;
 
     char *dom_console_xs_path;
     char dom_console_slave_tty_path[PATH_MAX];
@@ -397,6 +398,13 @@ int libxl_run_bootloader(libxl_ctx *ctx,
         goto out_close;
     }
 
+    bootloader = libxl__abs_path(gc, info->u.pv.bootloader,
+                                 libxl__libexec_path());
+    if ( bootloader == NULL ) {
+        rc = ERROR_NOMEM;
+        goto out_close;
+    }
+
     /*
      * We need to present the bootloader's tty as a pty slave that xenconsole
      * can access.  Since the bootloader itself needs a pty slave,
@@ -417,7 +425,7 @@ int libxl_run_bootloader(libxl_ctx *ctx,
     dom_console_xs_path = libxl__sprintf(gc, "%s/console/tty", libxl__xs_get_dompath(gc, domid));
     libxl__xs_write(gc, XBT_NULL, dom_console_xs_path, "%s", dom_console_slave_tty_path);
 
-    pid = fork_exec_bootloader(&bootloader_fd, info->u.pv.bootloader, args);
+    pid = fork_exec_bootloader(&bootloader_fd, bootloader, args);
     if (pid < 0) {
         goto out_close;
     }

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

* [PATCH 2 of 3] tools: Install pv bootloaders in libexec rather than /usr/bin
  2012-04-26 14:26 [PATCH 0 of 3] tools: Move bootloaders to libexec directory George Dunlap
  2012-04-26 14:26 ` [PATCH 1 of 3] libxl: Look for bootloader in libexec path George Dunlap
@ 2012-04-26 14:26 ` George Dunlap
  2012-04-26 14:26 ` [PATCH 3 of 3] libxl: Warn that /usr/bin/pygrub is deprecated George Dunlap
  2 siblings, 0 replies; 4+ messages in thread
From: George Dunlap @ 2012-04-26 14:26 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.

diff -r b810908dea7d -r 2783a97c5d5d tools/misc/Makefile
--- a/tools/misc/Makefile	Thu Apr 26 15:09:35 2012 +0100
+++ b/tools/misc/Makefile	Thu Apr 26 15:23:56 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 b810908dea7d -r 2783a97c5d5d tools/pygrub/Makefile
--- a/tools/pygrub/Makefile	Thu Apr 26 15:09:35 2012 +0100
+++ b/tools/pygrub/Makefile	Thu Apr 26 15:23:56 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] 4+ messages in thread

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

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

diff -r 2783a97c5d5d -r 1e09187be21d tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Thu Apr 26 15:23:56 2012 +0100
+++ b/tools/libxl/libxl_bootloader.c	Thu Apr 26 15:23:56 2012 +0100
@@ -15,6 +15,7 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 
 #include <termios.h>
+#include <string.h>
 
 #include "libxl_internal.h"
 
@@ -398,6 +399,11 @@ int libxl_run_bootloader(libxl_ctx *ctx,
         goto out_close;
     }
 
+    if ( !strncmp(info->u.pv.bootloader, "/usr/bin/pygrub", 20) )
+        LIBXL__LOG(ctx, LIBXL__LOG_WARNING,
+                   "WARNING: bootloader='/usr/bin/pygrub' "             \
+                   "is deprecated; use bootloader='pygrub' instead");
+    
     bootloader = libxl__abs_path(gc, info->u.pv.bootloader,
                                  libxl__libexec_path());
     if ( bootloader == NULL ) {

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

end of thread, other threads:[~2012-04-26 14:26 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).