All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] GNU GRUB program name transformations
@ 2007-01-25 10:27 Lubomir Kundrak
  2007-01-26 11:52 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 2+ messages in thread
From: Lubomir Kundrak @ 2007-01-25 10:27 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

Hi all,

I am maintaining a work-in-progress package [1] for the NetBSD package
system, pkgsrc. I was wondering how to avoid conflict between GRUB
Legacy and GRUB 2, letting them (their userspace utilities) coexist
side-by-side. IIRC, one single utility that was conflicting was
grub-install.

[1] http://pkgsrc-wip.cvs.sourceforge.net/pkgsrc-wip/wip/grub2/
[2] http://www.pkgsrc.org/

From my point of view, the best solution was to use the autoconf macro
AC_ARG_PROGRAM adding program name transformation options,
--program-transform-name, --program-prefix and --program-suffix. Side
effect of this is that it allows you to have multiple instances of GRUB
2 installed more comfortably.

The question is whether it is a good thing to transform program names by
default in vendor specific packages (as is done with current version of
pkgsrc package). Alternative solution would be to transform GRUB Legacy
filenames, which, though it might cause some confusion to Legacy users,
seems to be more appropropriate. Does GRUB Legacy support such
transformations in its most recent version?

Anone has other/better suggestions how to avoid GRUB Legacy/GRUB 2
conflict? I attach the patch which applies against current CVS snapshot
to this message.

Regards,
-- 
Lubomir Kundrak (Red Hat Security Response Team)

[-- Attachment #2: grub2-program-name-transform.patch --]
[-- Type: text/x-patch, Size: 3822 bytes --]

diff -urp grub2.orig/Makefile.in grub2/Makefile.in
--- grub2.orig/Makefile.in	2007-01-25 05:03:31.000000000 +0100
+++ grub2/Makefile.in	2007-01-25 05:09:07.000000000 +0100
@@ -52,6 +52,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 
+transform = @program_transform_name@
 mkinstalldirs = $(srcdir)/mkinstalldirs
 
 CC = @CC@
@@ -139,18 +140,18 @@ install-local: all
 	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	@list='$(bin_UTILITIES)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \
-	  dest="`echo $$file | sed 's,.*/,,'`"; \
+	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
 	done
 	$(mkinstalldirs) $(DESTDIR)$(sbindir)
 	@list='$(sbin_UTILITIES)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \
-	  dest="`echo $$file | sed 's,.*/,,'`"; \
+	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
 	done
 	@list='$(sbin_SCRIPTS)'; for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \
-	  dest="`echo $$file | sed 's,.*/,,'`"; \
+	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
 	done
 
@@ -164,11 +165,11 @@ uninstall:
 	  rm -f $(DESTDIR)$(pkglibdir)/$$dest; \
 	done
 	@list='$(bin_UTILITIES)'; for file in $$list; do \
-	  dest="`echo $$file | sed 's,.*/,,'`"; \
+	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  rm -f $(DESTDIR)$(bindir)/$$dest; \
 	done
 	@list='$(sbin_UTILITIES) $(sbin_SCRIPTS)'; for file in $$list; do \
-	  dest="`echo $$file | sed 's,.*/,,'`"; \
+	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  rm -f $(DESTDIR)$(sbindir)/$$dest; \
 	done
 
diff -urp grub2.orig/configure.ac grub2/configure.ac
--- grub2.orig/configure.ac	2007-01-25 05:03:31.000000000 +0100
+++ grub2/configure.ac	2007-01-25 05:03:48.000000000 +0100
@@ -40,6 +40,9 @@ AC_CONFIG_HEADER([config.h])
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
+# Program name transformations
+AC_ARG_PROGRAM
+
 case "$host_cpu" in
   powerpc64) host_m32=1 ;;
 esac
diff -urp grub2.orig/util/i386/pc/grub-install.in grub2/util/i386/pc/grub-install.in
--- grub2.orig/util/i386/pc/grub-install.in	2007-01-25 05:03:31.000000000 +0100
+++ grub2/util/i386/pc/grub-install.in	2007-01-25 05:19:55.000000000 +0100
@@ -29,11 +29,12 @@ PACKAGE_VERSION=@PACKAGE_VERSION@
 target_cpu=@target_cpu@
 platform=@platform@
 pkglibdir=${libdir}/${PACKAGE_TARNAME}/${target_cpu}-${platform}
+transform=@program_transform_name@
 
-grub_setup=${sbindir}/grub-setup
-grub_mkimage=${bindir}/grub-mkimage
-grub_mkdevicemap=${sbindir}/grub-mkdevicemap
-grub_probe=${sbindir}/grub-probe
+grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
+grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 rootdir=
 grub_prefix=/boot/grub
 modules=
diff -urp grub2.orig/util/powerpc/ieee1275/grub-install.in grub2/util/powerpc/ieee1275/grub-install.in
--- grub2.orig/util/powerpc/ieee1275/grub-install.in	2007-01-25 05:03:31.000000000 +0100
+++ grub2/util/powerpc/ieee1275/grub-install.in	2007-01-25 05:20:23.000000000 +0100
@@ -31,8 +31,9 @@ PACKAGE_VERSION=@PACKAGE_VERSION@
 target_cpu=@target_cpu@
 platform=@platform@
 pkglibdir=${libdir}/${PACKAGE_TARNAME}/${target_cpu}-${platform}
+transform=@program_transform_name@
 
-grub_mkimage=${bindir}/grub-mkimage
+grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
 rootdir=
 grub_prefix=/boot/grub
 modules=

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

end of thread, other threads:[~2007-01-26 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-25 10:27 [PATCH] GNU GRUB program name transformations Lubomir Kundrak
2007-01-26 11:52 ` Yoshinori K. Okuji

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.