From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1HA1pY-0004Xj-04 for mharc-grub-devel@gnu.org; Thu, 25 Jan 2007 05:27:44 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HA1pV-0004Xd-Qh for grub-devel@gnu.org; Thu, 25 Jan 2007 05:27:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HA1pU-0004XR-A6 for grub-devel@gnu.org; Thu, 25 Jan 2007 05:27:40 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HA1pU-0004XO-3r for grub-devel@gnu.org; Thu, 25 Jan 2007 05:27:40 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HA1pT-000868-Fr for grub-devel@gnu.org; Thu, 25 Jan 2007 05:27:39 -0500 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l0PARXCa031104 for ; Thu, 25 Jan 2007 05:27:33 -0500 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l0PARXJe018007 for ; Thu, 25 Jan 2007 05:27:33 -0500 Received: from [10.34.32.50] (pluto.brq.redhat.com [10.34.32.50]) by pobox.stuttgart.redhat.com (8.12.8/8.12.8) with ESMTP id l0PARWaK028568 for ; Thu, 25 Jan 2007 11:27:32 +0100 From: Lubomir Kundrak To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="=-k4rq1/KyAApwBi6NNW75" Organization: Red Hat Inc. Date: Thu, 25 Jan 2007 11:27:32 +0100 Message-Id: <1169720852.3386.38.camel@pluto> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2.1 (2.8.2.1-3.fc6) X-detected-kernel: Linux 2.4-2.6 Subject: [PATCH] GNU GRUB program name transformations X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jan 2007 10:27:42 -0000 --=-k4rq1/KyAApwBi6NNW75 Content-Type: text/plain Content-Transfer-Encoding: 7bit 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) --=-k4rq1/KyAApwBi6NNW75 Content-Disposition: attachment; filename=grub2-program-name-transform.patch Content-Type: text/x-patch; name=grub2-program-name-transform.patch; charset=utf8 Content-Transfer-Encoding: 7bit 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= --=-k4rq1/KyAApwBi6NNW75--