All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lubomir Kundrak <lkundrak@redhat.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] Fix file name transformations (mostly)
Date: Tue, 15 Apr 2008 00:12:28 +0200	[thread overview]
Message-ID: <1208211148.3971.38.camel@localhost.localdomain> (raw)

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

Hi,

Attaching the patch that fixes ./configure's --program-transform-name
option. Tested with --program-transform-name=s,grub,grub2, quite
extensively. Only one more modification is needed to completely support
this -- define DEFAULT_DIRECTORY with -D option of the preprocessor
instead of hardcoding in include/grub/util/misc.h. Should be fairly
trivial though.

2008-04-15  Lubomir Kundrak  <lkundrak@redhat.com>

	* Makefile.in: Honor program name transformations.
	* util/grub.d/00_header.in:  Honor program name transformations.
	* util/grub.d/10_linux.in:  Honor program name transformations.
	* util/i386/pc/grub-install.in:  Honor program name
	transformations.
	* util/i386/pc/grub-mkrescue.in:  Honor program name
	transformations.
	* powerpc/ieee1275/grub-mkrescue.in:  Honor program name
	transformations.
	* util/update-grub.in:  Honor program name transformations.
	* util/update-grub_lib.in:  Honor program name transformations.

-- 
Lubomir Kundrak (Red Hat Security Response Team)

[-- Attachment #2: grub-1.96-transform.patch --]
[-- Type: text/x-patch, Size: 7016 bytes --]

diff -urp grub-1.96.orig/Makefile.in grub-1.96/Makefile.in
--- grub-1.96.orig/Makefile.in	2008-01-12 01:31:54.000000000 +0100
+++ grub-1.96/Makefile.in	2008-03-16 17:53:12.000000000 +0100
@@ -189,12 +189,12 @@ install-local: all
 	  dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
 	  $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \
 	done
-	$(mkinstalldirs) $(DESTDIR)$(libdir)/grub
+	$(mkinstalldirs) $(DESTDIR)$(libdir)/`echo grub | sed '$(transform)'`
 	@list='$(lib_DATA)'; \
 	for file in $$list; do \
 	  if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
 	  dest="`echo $$file | sed 's,.*/,,'`"; \
-	  $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
+	  $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/`echo grub | sed '$(transform)'`/$$dest; \
 	done
 
 install-strip:
diff -urp grub-1.96.orig/util/grub.d/00_header.in grub-1.96/util/grub.d/00_header.in
--- grub-1.96.orig/util/grub.d/00_header.in	2008-02-03 14:11:33.000000000 +0100
+++ grub-1.96/util/grub.d/00_header.in	2008-03-16 17:53:12.000000000 +0100
@@ -16,13 +16,15 @@
 # You should have received a copy of the GNU General Public License
 # along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
+transform="@program_transform_name@"
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 platform=@platform@
 
 # for convert_system_path_to_grub_path()
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
 
 # Do this as early as possible, since other commands might depend on it.
 # (e.g. the `font' command might need lvm or raid modules)
diff -urp grub-1.96.orig/util/grub.d/10_linux.in grub-1.96/util/grub.d/10_linux.in
--- grub-1.96.orig/util/grub.d/10_linux.in	2008-02-03 14:11:33.000000000 +0100
+++ grub-1.96/util/grub.d/10_linux.in	2008-03-16 17:55:39.000000000 +0100
@@ -16,10 +16,12 @@
 # You should have received a copy of the GNU General Public License
 # along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
+transform="@program_transform_name@"
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
 
 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
   OS=GNU/Linux
diff -urp grub-1.96.orig/util/i386/pc/grub-install.in grub-1.96/util/i386/pc/grub-install.in
--- grub-1.96.orig/util/i386/pc/grub-install.in	2008-02-03 14:11:33.000000000 +0100
+++ grub-1.96/util/i386/pc/grub-install.in	2008-03-16 17:56:16.000000000 +0100
@@ -36,7 +36,7 @@ grub_mkimage=${bindir}/`echo grub-mkimag
 grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 rootdir=
-grub_prefix=`echo /boot/grub | sed ${transform}`
+grub_prefix=/boot/`echo grub | sed ${transform}`
 modules=
 
 install_device=
@@ -46,7 +46,7 @@ recheck=no
 debug=no
 
 # for make_system_path_relative_to_its_root()
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
 
 # Usage: usage
 # Print the usage.
diff -urp grub-1.96.orig/util/i386/pc/grub-mkrescue.in grub-1.96/util/i386/pc/grub-mkrescue.in
--- grub-1.96.orig/util/i386/pc/grub-mkrescue.in	2008-02-03 14:11:33.000000000 +0100
+++ grub-1.96/util/i386/pc/grub-mkrescue.in	2008-03-16 17:58:52.000000000 +0100
@@ -55,7 +55,6 @@ EOF
 
 image_type=cdrom
 input_dir=${pkglibdir}
-grub_mkimage=grub-mkimage
 
 # Check the arguments.
 for option in "$@"; do
@@ -109,10 +108,10 @@ else
 fi
 
 memdisk_dir=`mktemp -d`
-mkdir -p ${memdisk_dir}/boot/grub
+mkdir -p ${memdisk_dir}/boot/`echo grub | sed ${transform}`
 cp ${input_dir}/*.mod \
   ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
-  ${memdisk_dir}/boot/grub/
+  ${memdisk_dir}/boot/`echo grub | sed ${transform}`/
 
 if test "x$overlay" = x ; then : ; else
   cp -dpR ${overlay}/* ${memdisk_dir}/
diff -urp grub-1.96.orig/util/powerpc/ieee1275/grub-mkrescue.in grub-1.96/util/powerpc/ieee1275/grub-mkrescue.in
--- grub-1.96.orig/util/powerpc/ieee1275/grub-mkrescue.in	2008-01-31 18:09:39.000000000 +0100
+++ grub-1.96/util/powerpc/ieee1275/grub-mkrescue.in	2008-03-16 17:57:31.000000000 +0100
@@ -101,7 +101,7 @@ grub.img        Raw     'UNIX'    'tbxi'
 EOF
 
 iso_dir=`mktemp -d`
-boot_dir=${iso_dir}/boot/grub
+boot_dir=${iso_dir}/boot/`echo grub | sed ${transform}`
 mkdir ${iso_dir}/boot
 mkdir ${boot_dir}
 core_img=${boot_dir}/grub.img
diff -urp grub-1.96.orig/util/update-grub.in grub-1.96/util/update-grub.in
--- grub-1.96.orig/util/update-grub.in	2008-03-16 17:52:32.000000000 +0100
+++ grub-1.96/util/update-grub.in	2008-03-16 17:59:42.000000000 +0100
@@ -23,7 +23,7 @@ exec_prefix=@exec_prefix@
 sbindir=@sbindir@
 libdir=@libdir@
 sysconfdir=@sysconfdir@
-grub_prefix=`echo /boot/grub | sed ${transform}`
+grub_prefix=/boot/`echo /grub | sed ${transform}`
 grub_cfg=${grub_prefix}/grub.cfg
 update_grub_dir=${sysconfdir}/grub.d
 platform=@platform@
@@ -32,7 +32,7 @@ grub_mkdevicemap=${sbindir}/`echo grub-m
 grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
 
 # for convert_system_path_to_grub_path(), font_path()
-. ${libdir}/grub/update-grub_lib
+. ${libdir}/`echo grub | sed ${transform}`/update-grub_lib
 
 if [ "x$UID" = "x" ] ; then
   UID=`id -u`
@@ -66,24 +66,24 @@ fi
 mkdir -p ${grub_prefix}
 
 if test -e ${grub_prefix}/device.map ; then : ; else
-  grub-mkdevicemap
+  ${grub_mkdevicemap}
 fi
 
 # Device containing our userland.  Typically used for root= parameter.
-GRUB_DEVICE="`grub-probe --target=device /`"
+GRUB_DEVICE="`${grub_probe} --target=device /`"
 
 # Filesystem for the device containing our userland.  Used for stuff like
 # choosing Hurd filesystem module.
-GRUB_FS="`grub-probe --target=fs / 2> /dev/null || echo unknown`"
+GRUB_FS="`${grub_probe} --target=fs / 2> /dev/null || echo unknown`"
 
 # GRUB path to /.  Only used for "set root=".  Not critical.
-GRUB_DRIVE="`grub-probe --target=drive /`" || true
+GRUB_DRIVE="`${grub_probe} --target=drive /`" || true
 
 # GRUB path to /boot
 GRUB_DRIVE_BOOT="`convert_system_path_to_grub_path /boot`"
 
 # GRUB path to /boot/grub
-GRUB_DRIVE_BOOT_GRUB="`convert_system_path_to_grub_path /boot/grub`"
+GRUB_DRIVE_BOOT_GRUB="`convert_system_path_to_grub_path ${grub_prefix}`"
 
 defaults=`echo ${sysconfdir}/sysconfig/grub | sed ${transform}`
 if test -f ${defaults}; then
--- grub-1.96.orig/util/update-grub_lib.in.transform	2008-03-23 11:46:14.000000000 +0100
+++ grub-1.96/util/update-grub_lib.in	2008-03-23 11:49:21.000000000 +0100
@@ -95,7 +95,8 @@
 {
   # Prefer system path for space reasons (/boot/grub might be a very small
   # partition in case of OpenFirmware, etc).
-  for dir in ${pkgdatadir} /usr/share/grub /boot/grub ; do
+  for dir in ${pkgdatadir} ${pkgdatadir}/`echo grub | sed ${transform}` \
+             /boot/`echo grub | sed ${transform}`; do
     # Prefer complete fonts over incomplete ones.
     for basename in unicode unifont ascii ; do
       path="${dir}/${basename}.pff"

             reply	other threads:[~2008-04-14 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 22:12 Lubomir Kundrak [this message]
2008-04-15 13:33 ` [PATCH] Fix file name transformations (mostly) Robert Millan
2008-04-17 11:47   ` Lubomir Kundrak
2008-04-15 19:19 ` Pavel Roskin
2008-04-17 11:49   ` Lubomir Kundrak
2008-04-17 19:20     ` Pavel Roskin
2008-04-17 20:07       ` Robert Millan
2008-04-18  6:41       ` Lubomir Kundrak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208211148.3971.38.camel@localhost.localdomain \
    --to=lkundrak@redhat.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.