* [PATCH] Fix file name transformations (mostly)
@ 2008-04-14 22:12 Lubomir Kundrak
2008-04-15 13:33 ` Robert Millan
2008-04-15 19:19 ` Pavel Roskin
0 siblings, 2 replies; 8+ messages in thread
From: Lubomir Kundrak @ 2008-04-14 22:12 UTC (permalink / raw)
To: The development of GRUB 2
[-- 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"
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Fix file name transformations (mostly)
2008-04-14 22:12 [PATCH] Fix file name transformations (mostly) Lubomir Kundrak
@ 2008-04-15 13:33 ` Robert Millan
2008-04-17 11:47 ` Lubomir Kundrak
2008-04-15 19:19 ` Pavel Roskin
1 sibling, 1 reply; 8+ messages in thread
From: Robert Millan @ 2008-04-15 13:33 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, Apr 15, 2008 at 12:12:28AM +0200, Lubomir Kundrak wrote:
> 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}`
Is the second slash intentional?
> --- 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
I'd prefer is grub_prefix was defined here too (for readability).
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Fix file name transformations (mostly)
2008-04-15 13:33 ` Robert Millan
@ 2008-04-17 11:47 ` Lubomir Kundrak
0 siblings, 0 replies; 8+ messages in thread
From: Lubomir Kundrak @ 2008-04-17 11:47 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-04-15 at 15:33 +0200, Robert Millan wrote:
> On Tue, Apr 15, 2008 at 12:12:28AM +0200, Lubomir Kundrak wrote:
> > 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}`
>
> Is the second slash intentional?
No.
> > --- 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
>
> I'd prefer is grub_prefix was defined here too (for readability).
Yep, there's space for improvement. See Pavel's reply to that mail.
Thanks,
--
Lubomir Kundrak (Red Hat Security Response Team)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix file name transformations (mostly)
2008-04-14 22:12 [PATCH] Fix file name transformations (mostly) Lubomir Kundrak
2008-04-15 13:33 ` Robert Millan
@ 2008-04-15 19:19 ` Pavel Roskin
2008-04-17 11:49 ` Lubomir Kundrak
1 sibling, 1 reply; 8+ messages in thread
From: Pavel Roskin @ 2008-04-15 19:19 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-04-15 at 00:12 +0200, Lubomir Kundrak wrote:
> 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.
I would prefer if we don't rush with "program-transform-name" at the
expense of readability, but rather make other simplifications what would
have a similar effect. I think ${libdir}/grub should be given a name
(e.g. grublibdir) in configure.ac and substituted in the scripts.
As for /boot/grub, we are not installing anything there on "make
install". I don't think it should be transformed. But we could accept
a configuration option to change that directory.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Fix file name transformations (mostly)
2008-04-15 19:19 ` Pavel Roskin
@ 2008-04-17 11:49 ` Lubomir Kundrak
2008-04-17 19:20 ` Pavel Roskin
0 siblings, 1 reply; 8+ messages in thread
From: Lubomir Kundrak @ 2008-04-17 11:49 UTC (permalink / raw)
To: The development of GRUB 2
On Tue, 2008-04-15 at 15:19 -0400, Pavel Roskin wrote:
> On Tue, 2008-04-15 at 00:12 +0200, Lubomir Kundrak wrote:
> > 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.
>
> I would prefer if we don't rush with "program-transform-name" at the
> expense of readability, but rather make other simplifications what would
> have a similar effect. I think ${libdir}/grub should be given a name
> (e.g. grublibdir) in configure.ac and substituted in the scripts.
That makes sense. Another solution would be to have shell library to
include by all scripts and define variables with substituted names
there.
> As for /boot/grub, we are not installing anything there on "make
> install". I don't think it should be transformed. But we could accept
> a configuration option to change that directory.
We should have a sensible default that wouldn't clash with GRUB Legacy's
default.
Thanks,
--
Lubomir Kundrak (Red Hat Security Response Team)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Fix file name transformations (mostly)
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
0 siblings, 2 replies; 8+ messages in thread
From: Pavel Roskin @ 2008-04-17 19:20 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, 2008-04-17 at 13:49 +0200, Lubomir Kundrak wrote:
> > As for /boot/grub, we are not installing anything there on "make
> > install". I don't think it should be transformed. But we could accept
> > a configuration option to change that directory.
>
> We should have a sensible default that wouldn't clash with GRUB Legacy's
> default.
There is no clash here. Names of all files under /boot/grub are
different, except device.map. But device.map has the same format and is
system specific.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix file name transformations (mostly)
2008-04-17 19:20 ` Pavel Roskin
@ 2008-04-17 20:07 ` Robert Millan
2008-04-18 6:41 ` Lubomir Kundrak
1 sibling, 0 replies; 8+ messages in thread
From: Robert Millan @ 2008-04-17 20:07 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, Apr 17, 2008 at 03:20:29PM -0400, Pavel Roskin wrote:
> On Thu, 2008-04-17 at 13:49 +0200, Lubomir Kundrak wrote:
>
> > > As for /boot/grub, we are not installing anything there on "make
> > > install". I don't think it should be transformed. But we could accept
> > > a configuration option to change that directory.
> >
> > We should have a sensible default that wouldn't clash with GRUB Legacy's
> > default.
>
> There is no clash here. Names of all files under /boot/grub are
> different, except device.map. But device.map has the same format and is
> system specific.
Lubomir, if you're worried about making GRUB 2 and Legacy coexist, I can
confirm you it's perfectly possible using the same directory. In Debian we
do that in fact (I only had to fix grub-install removing menu.lst, but that's
all).
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix file name transformations (mostly)
2008-04-17 19:20 ` Pavel Roskin
2008-04-17 20:07 ` Robert Millan
@ 2008-04-18 6:41 ` Lubomir Kundrak
1 sibling, 0 replies; 8+ messages in thread
From: Lubomir Kundrak @ 2008-04-18 6:41 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, 2008-04-17 at 15:20 -0400, Pavel Roskin wrote:
> On Thu, 2008-04-17 at 13:49 +0200, Lubomir Kundrak wrote:
>
> > > As for /boot/grub, we are not installing anything there on "make
> > > install". I don't think it should be transformed. But we could accept
> > > a configuration option to change that directory.
> >
> > We should have a sensible default that wouldn't clash with GRUB Legacy's
> > default.
>
> There is no clash here. Names of all files under /boot/grub are
> different, except device.map. But device.map has the same format and is
> system specific.
Though I am convinced that directories were invented to avoid mixing
apples with oranges (or dead horses, and ponnies, oh well), sharing
device.map sounds usable and is a rather good argument.
I'll try to rework the patch and taka that into account.
--
Lubomir Kundrak (Red Hat Security Response Team)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-04-18 6:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 22:12 [PATCH] Fix file name transformations (mostly) Lubomir Kundrak
2008-04-15 13:33 ` 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
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.