update-grub2
Hi there,
This is my proposal for a new dessign in update-grub. As you might know, update-grub is a script used in Debian to generate GRUB config file. Over time, we've found that the monolithic dessign of that script made it difficult to maintain and extend, and it ultimately has become bloated. I'm redessigning it to be simple, modular and easily extensible.
With this work, we solve another problem: the copyright for original update-grub was held by several people and it was too difficult to attain the paperwork FSF projects require for submitting the script to you.
The script I'm attaching is mostly meant as proof of concept to show the proposed framework for generating the config file and allowing third-party apps (memtest86, etc) to hook their stuff in.
Please send me your feedback and tell wether you like it. I think it'd be very good if a unified solution for this were provided from GRUB upstream, instead of each distributor cooking up their own.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
update-grub +77 -0
@@ -0,0 +1,77 @@ +#! /bin/bash -e + +# Generate grub.cfg by inspecting /boot contents. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +grub_prefix=/boot/grub +grub_cfg=${grub_prefix}/grub.cfg +update_grub_dir=/etc/update-grub.d +test_mode=false + +if [ "$UID" != 0 ] ; then + echo "$0: You must run this as root" + exit 1 +fi + +if [ "$1" == "-y" ] ; then + echo "$0: warning: Ignoring -y option (no longer needed)." +fi + +if ! test -d ${update_grub_dir} && test -d ./update-grub.d ; then + update_grub_dir=./update-grub.d + test_mode=true +fi + +if ! which grub-probe > /dev/null ; then + echo "$0: grub-probe not found in PATH." + exit 1 +fi + +if ! ${test_mode} ; then + exec > ${grub_cfg}.new +fi + +cat << EOF +# +# DO NOT EDIT THIS FILE +# +# It is automaticaly generated by $0 using templates from ${update_grub_dir} +# +EOF + +export GRUB_DEVICE="`grub-probe --target=device ${grub_prefix}`" +export GRUB_DRIVE="`grub-probe --target=drive ${grub_prefix}`" +export GRUB_FS="`grub-probe --target=fs ${grub_prefix}`" + +shopt -s nullglob ; for i in ${update_grub_dir}/* ; do + case $i in + # emacsen backup files. FIXME: support other editors + *~) ;; + *) + if test -x $i ; then + echo -e "\n### BEGIN $i ###" + $i + echo "### END $i ###" + fi + ;; + esac +done + +# none of the children aborted with error, install the new grub.cfg +if ! ${test_mode} ; then + exec mv ${grub_cfg}{.new,} +fi
update-grub.d/00_header +28 -0
@@ -0,0 +1,28 @@ +#! /bin/bash -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + +if [ -z "${GRUB_DEFAULT}" ] ; then GRUB_DEFAULT=0 ; fi +if [ -z "${GRUB_TIMEOUT}" ] ; then GRUB_TIMEOUT=5 ; fi + +cat << EOF +set default=${GRUB_DEFAULT} +set timeout=${GRUB_TIMEOUT} +set root=${GRUB_DRIVE} +EOF
update-grub.d/10_hurd +65 -0
65 lines not on this page · raw message
update-grub.d/10_linux +36 -0
@@ -0,0 +1,36 @@ +#! /bin/bash -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +shopt -s nullglob + +for linux in /{boot/,}vmlinuz-* ; do + version=`echo $linux | sed -e "s,.*/[^0-9]*-,,g"` + basedir=`echo $linux | sed -e "s,/[^/]*$,,g"` + cat << EOF +menuentry "GNU/Linux, linux ${version}" { + linux ${linux} root=${GRUB_DEVICE} ro +EOF + if test -e /boot/initrd.img-${version} ; then cat << EOF + initrd ${dir}/initrd.img-${version} +EOF + fi + cat << EOF +} +EOF +done
update-grub.d/README +11 -0
@@ -0,0 +1,11 @@ + +All executable files in this directory are processed in shell expansion order. + + 00_*: Reserved for 00_header. + 10_*: Native boot entries. + 20_*: Third party apps (e.g. memtest86). + +The number namespace in-between is configurable by system installer and/or +administrator. For example, you can add an entry to boot another OS as +01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +the menu; and then adjust the default setting by editting 00_header.
Maybe this isn't the right place, but..
I've been pissed off a couple of times by my grub config being overwritten after installing a new kernel on Ubuntu (presumably the same happens on Debian) - I don't get why it doesn't simply add the new kernel rather than regenerate the entire file?
If you think this is too off-topic then ignore if you will or email me privately :)
Quoted 36 lines · Robert Millan
Hi there,
This is my proposal for a new dessign in update-grub. As you might know, update-grub is a script used in Debian to generate GRUB config file. Over time, we've found that the monolithic dessign of that script made it difficult to maintain and extend, and it ultimately has become bloated. I'm redessigning it to be simple, modular and easily extensible.
With this work, we solve another problem: the copyright for original update-grub was held by several people and it was too difficult to attain the paperwork FSF projects require for submitting the script to you.
The script I'm attaching is mostly meant as proof of concept to show the proposed framework for generating the config file and allowing third-party apps (memtest86, etc) to hook their stuff in.
Please send me your feedback and tell wether you like it. I think it'd be very good if a unified solution for this were provided from GRUB upstream, instead of each distributor cooking up their own.
--
Robert MillanMy spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 1 line
Declan Naughton
Quoted 9 lines · Declan Naughton
Maybe this isn't the right place, but..
I've been pissed off a couple of times by my grub config being overwritten after installing a new kernel on Ubuntu (presumably the same happens on Debian) - I don't get why it doesn't simply add the new kernel rather than regenerate the entire file?
If you think this is too off-topic then ignore if you will or email me privately :)
Yes, it is :)
I'm not the person (nor this is the place) to answer about that, but note that my proposal for update-grub2 doesn't keep state from former config files. That's a very awkward (and as you already found out, very error-prone) that I wouldn't recommend having at all.
In my proposed framework, if you want to customise the configuration you have to do it at the source (in /etc/update-grub.d or whatever it'll be called).
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Otavio Salvador
Quoted 7 lines · Robert Millan
Hi there,
This is my proposal for a new dessign in update-grub. As you might know, update-grub is a script used in Debian to generate GRUB config file. Over time, we've found that the monolithic dessign of that script made it difficult to maintain and extend, and it ultimately has become bloated. I'm redessigning it to be simple, modular and easily extensible.
Quoted 6 lines
It looks great! It's simple and flexible.
Robert, we could start to implement it on Debian side to start to grab "plugins" for other uses. We should also check what's the current feature set of update-grub and start a campain inside of Debian to grab the need "plugins" to don't have regressions for end user.
I think we should wait to see what upstream (CCed) says. If upstream GRUB includes this feature, then it's an upstream issue for the other projects as well.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
ping (update-grub2)
In reply to Robert MillanNo comments? Are you interested in getting this into the main grub tree? In my opinion, since update-grub needs a rewrite it's a good oportunity to merge this now and unify grub.cfg generation across distributions (something that wasn't possible with the old update-grub because of copyright issues).
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
Quoted 269 lines · Robert Millan
Hi there,
This is my proposal for a new dessign in update-grub. As you might know, update-grub is a script used in Debian to generate GRUB config file. Over time, we've found that the monolithic dessign of that script made it difficult to maintain and extend, and it ultimately has become bloated. I'm redessigning it to be simple, modular and easily extensible.
With this work, we solve another problem: the copyright for original update-grub was held by several people and it was too difficult to attain the paperwork FSF projects require for submitting the script to you.
The script I'm attaching is mostly meant as proof of concept to show the proposed framework for generating the config file and allowing third-party apps (memtest86, etc) to hook their stuff in.
Please send me your feedback and tell wether you like it. I think it'd be very good if a unified solution for this were provided from GRUB upstream, instead of each distributor cooking up their own.
Signature · 6 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list. diff -Nur empty/update-grub update-grub/update-grubupdate-grub +77
-0@@ -0,0 +1,77 @@ +#! /bin/bash -e + +# Generate grub.cfg by inspecting /boot contents. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +grub_prefix=/boot/grub +grub_cfg=${grub_prefix}/grub.cfg +update_grub_dir=/etc/update-grub.d +test_mode=false + +if [ "$UID" != 0 ] ; then + echo "$0: You must run this as root" + exit 1 +fi + +if [ "$1" == "-y" ] ; then + echo "$0: warning: Ignoring -y option (no longer needed)." +fi + +if ! test -d ${update_grub_dir} && test -d ./update-grub.d ; then + update_grub_dir=./update-grub.d + test_mode=true +fi + +if ! which grub-probe > /dev/null ; then + echo "$0: grub-probe not found in PATH." + exit 1 +fi + +if ! ${test_mode} ; then + exec > ${grub_cfg}.new +fi + +cat << EOF +# +# DO NOT EDIT THIS FILE +# +# It is automaticaly generated by $0 using templates from ${update_grub_dir} +# +EOF + +export GRUB_DEVICE="`grub-probe --target=device ${grub_prefix}`" +export GRUB_DRIVE="`grub-probe --target=drive ${grub_prefix}`" +export GRUB_FS="`grub-probe --target=fs ${grub_prefix}`" + +shopt -s nullglob ; for i in ${update_grub_dir}/* ; do + case $i in + # emacsen backup files. FIXME: support other editors + *~) ;; + *) + if test -x $i ; then + echo -e "\n### BEGIN $i ###" + $i + echo "### END $i ###" + fi + ;; + esac +done + +# none of the children aborted with error, install the new grub.cfg +if ! ${test_mode} ; then + exec mv ${grub_cfg}{.new,} +fidiff -Nur empty/update-grub.d/00_header update-grub/update-grub.d/00_header
update-grub.d/00_header +28
-0@@ -0,0 +1,28 @@ +#! /bin/bash -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + +if [ -z "${GRUB_DEFAULT}" ] ; then GRUB_DEFAULT=0 ; fi +if [ -z "${GRUB_TIMEOUT}" ] ; then GRUB_TIMEOUT=5 ; fi + +cat << EOF +set default=${GRUB_DEFAULT} +set timeout=${GRUB_TIMEOUT} +set root=${GRUB_DRIVE} +EOFdiff -Nur empty/update-grub.d/10_hurd update-grub/update-grub.d/10_hurd
update-grub.d/10_hurd +65
-0@@ -0,0 +1,65 @@ +#! /bin/bash -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +# FIXME: add l4 here? +kernel= +for i in /boot/gnumach{.gz,} ; do + if test -e $i ; then + kernel=$i + fi +done + +# FIXME: This works for ext2. For other filesystems we might need special-casing +case "${GRUB_FS}" in + *fs) hurd_fs="${GRUB_FS}" ;; + *) hurd_fs="${GRUB_FS}fs" ;; +esac + +at_least_one=false +all_of_them=true +for i in "${kernel}" /hurd/${hurd_fs}.static /hurd/exec ; do + if test -e "$i" ; then + at_least_one=true + else + all_of_them=false + fi +done + +if ! ${at_least_one} ; then + # no hurd here, aborting + exit 0 +fi + +if ! ${all_of_them} || ! test -e /lib/ld.so.1 ; then + echo "Some Hurd stuff found, but not enough to boot." + exit 1 +fi + +cat << EOF +menuentry "GNU" { + multiboot ${kernel} root=device:${GRUB_DEVICE} + module /hurd/${hurd_fs}.static --readonly \\ + --multiboot-command-line='\${kernel-command-line}' \\ + --host-priv-port='\${host-port}' \\ + --device-master-port='\${device-port}' \\ + --exec-server-task='\${exec-task}' -T typed '\${root}' \\ + '\$(task-create)' '\$(task-resume)' + module /lib/ld.so.1 /hurd/exec '\$(exec-task=task-create)' +} +EOFdiff -Nur empty/update-grub.d/10_linux update-grub/update-grub.d/10_linux
update-grub.d/10_linux +36
-0@@ -0,0 +1,36 @@ +#! /bin/bash -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + +shopt -s nullglob + +for linux in /{boot/,}vmlinuz-* ; do + version=`echo $linux | sed -e "s,.*/[^0-9]*-,,g"` + basedir=`echo $linux | sed -e "s,/[^/]*$,,g"` + cat << EOF +menuentry "GNU/Linux, linux ${version}" { + linux ${linux} root=${GRUB_DEVICE} ro +EOF + if test -e /boot/initrd.img-${version} ; then cat << EOF + initrd ${dir}/initrd.img-${version} +EOF + fi + cat << EOF +} +EOF +donediff -Nur empty/update-grub.d/README update-grub/update-grub.d/README
update-grub.d/README +11
-0@@ -0,0 +1,11 @@ + +All executable files in this directory are processed in shell expansion order. + + 00_*: Reserved for 00_header. + 10_*: Native boot entries. + 20_*: Third party apps (e.g. memtest86). + +The number namespace in-between is configurable by system installer and/or +administrator. For example, you can add an entry to boot another OS as +01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +the menu; and then adjust the default setting by editting 00_header._______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Re: ping (update-grub2)
Le lundi 27 novembre 2006 18:00, Robert Millan a écrit :
Quoted 10 lines
No comments? Are you interested in getting this into the main grub tree? In my opinion, since update-grub needs a rewrite it's a good oportunity to merge this now and unify grub.cfg generation across distributions (something that wasn't possible with the old update-grub because of copyright issues).
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
Personally, the way update-grub works on all my applicable debian installs suits me perfectly.
But as Declan said, it's bad to overwrite the file...
I wonder if it could become just a generation of a file which would be included (or not) by the "main" config file.
If that main config file does not exist at all, it could be generated - unless we consider that a user might want not to have a config file at all.
I don't know if the current scripting allows this, I haven't put an eye on it for a looong time.
Another idea, which I just had while writing this mail :
What about putting the .d directory in /boot(/grub) and implementing a mechanism in grub to be able to handle such configuration directory ? My idea is about multi-OS (multi-distro, whatever) users, which have to privilege one among and merge the boot possibilities - by hand most probably. If this offers a common way of storing boot entries, it can solve that problem.
In my idea, I would go even further by suggesting a non grub-specific way of doing so, allowing to switch bootloaders which would support such configuration layouts. But I guess few people are ready to spend much effort in making boot loaders compatible one with the other...
Signature · 1 line
Vincent Pelletier
update-grub again (Re: ping (update-grub2))
Quoted 7 lines · Vincent Pelletier
Quoted 4 lines
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
Personally, the way update-grub works on all my applicable debian installs suits me perfectly.
When you just run it and see it works, everything seems wonderful. But have a look at the code; everyone has been adding their cruft for ages, and it's completely unmanageable now. By taking a modular approach, we can have a simple core that is easily maintainable, and unload the responsability for modules to the applications they're associated with.
Quoted 8 lines
But as Declan said, it's bad to overwrite the file...
I wonder if it could become just a generation of a file which would be included (or not) by the "main" config file.
If that main config file does not exist at all, it could be generated - unless we consider that a user might want not to have a config file at all.I don't know if the current scripting allows this, I haven't put an eye on it for a looong time.
I'm not particularly interested about that, but it's trivial to implement it later provided that grub scripting supports it.
Quoted 4 lines
Another idea, which I just had while writing this mail :
What about putting the .d directory in /boot(/grub) and implementing a mechanism in grub to be able to handle such configuration directory ?
That's not feasible. The script modules do complex stuff that couldn't be done comfortably if we were in kernel-mode C instead of shell scripting (check out what my scripts do and you'll see what I mean).
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: ping (update-grub2)
Quoted 1 line · Jason Thomas
I think now is the time. Lets do it.
You mean in Debian? If upstream is not interested, I'd really prefer an explicit answer, just to be sure.
Quoted 33 lines · Robert Millan
Quoted 32 lines
No comments? Are you interested in getting this into the main grub tree? In my opinion, since update-grub needs a rewrite it's a good oportunity to merge this now and unify grub.cfg generation across distributions (something that wasn't possible with the old update-grub because of copyright issues).
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
Quoted 20 lines · Robert Millan
Hi there,
This is my proposal for a new dessign in update-grub. As you might know, update-grub is a script used in Debian to generate GRUB config file. Over time, we've found that the monolithic dessign of that script made it difficult to maintain and extend, and it ultimately has become bloated. I'm redessigning it to be simple, modular and easily extensible.
With this work, we solve another problem: the copyright for original update-grub was held by several people and it was too difficult to attain the paperwork FSF projects require for submitting the script to you.
The script I'm attaching is mostly meant as proof of concept to show the proposed framework for generating the config file and allowing third-party apps (memtest86, etc) to hook their stuff in.
Please send me your feedback and tell wether you like it. I think it'd be very good if a unified solution for this were provided from GRUB upstream, instead of each distributor cooking up their own.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Re: ping (update-grub2)
In reply to Robert MillanQuoted 10 lines · Robert Millan
No comments? Are you interested in getting this into the main grub tree? In my opinion, since update-grub needs a rewrite it's a good oportunity to merge this now and unify grub.cfg generation across distributions (something that wasn't possible with the old update-grub because of copyright issues).
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
I describe my own opinion. If others do not agree, let me know.
If the script is generic enough, and other projects are willing to use it, it is convenient to put it in official versions ("official" means "upstream" in Debian, but I don't like the term "upstream" very much, BTW). So, in this case, I accept it. But if it is used only for Debian, I don't think it is worth doing.
I know it is not so nice to put distribution-specific scripts in official versions with my past experience, because official versions are not always synchronized with distribution versions, so when a script in an official version is "outdated" for a distribution, it is necessary to locally patch the script, and this effort can be quite painful, if you always need to make patches for every version.
That's why we don't have the directory "debian" any longer. We had it in GRUB legacy in version 0.5.92 or something when Gordon was the maintainer of the GRUB package in Debian. But this became really annoying after Gordon got inactive, because I had no idea on how to maintain it, as I was not a Debian user then. And, someone (I think he was Jason Thomas) complained, and I decided to drop it from the official version.
Okuji
update-grub again (Re: ping (update-grub2))
On Tue, Nov 28, 2006 at 08:26:48AM +0100, Yoshinori K. Okuji wrote:
I'm terribly late at repliing here :-) - sorry about that. It's about lack of time, not lack of interest.
Quoted 12 lines · Robert Millan
Quoted 10 lines
No comments? Are you interested in getting this into the main grub tree? In my opinion, since update-grub needs a rewrite it's a good oportunity to merge this now and unify grub.cfg generation across distributions (something that wasn't possible with the old update-grub because of copyright issues).
That said, if you don't like the idea then we could proceed adding it in debian, but that might close the door to merging in the future (maintaining the script in debian ourselves implies accepting contributions from many people without any paperwork arrangements).
Quoted 7 lines
I describe my own opinion. If others do not agree, let me know.
If the script is generic enough, and other projects are willing to use it, it is convenient to put it in official versions ("official" means "upstream" in Debian, but I don't like the term "upstream" very much, BTW). So, in this case, I accept it. But if it is used only for Debian, I don't think it is worth doing.
The script is not Debian-specific in nature, and it can be used by other distributors. Of course, since I wrote it in Debian it's not known to work elsewhere, but there's nothing inherently unportable about it.
Quoted 7 lines
I know it is not so nice to put distribution-specific scripts in official versions with my past experience, because official versions are not always synchronized with distribution versions, so when a script in an official version is "outdated" for a distribution, it is necessary to locally patch the script, and this effort can be quite painful, if you always need to make patches for every version.
Quoted 6 lines
That's why we don't have the directory "debian" any longer. We had it in GRUB legacy in version 0.5.92 or something when Gordon was the maintainer of the GRUB package in Debian. But this became really annoying after Gordon got inactive, because I had no idea on how to maintain it, as I was not a Debian user then. And, someone (I think he was Jason Thomas) complained, and I decided to drop it from the official version.
I understand your concern. Shouldn't be a problem with update-grub IMHO.
If you're ok with it, I'll refurbish it into a patch against CVS so that you can confirm the changes.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
update-grub2 patch
Here's my patch. Let me know if it's ok for commit.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2007-04-17 Robert Millan <[email protected]>
* DISTLIST: Add util/update-grub.in, util/grub.d/00_header.in, util/grub.d/10_hurd.in, util/grub.d/10_linux.in and util/grub.d/README.
* Makefile.in: Declare enable_update_grub. Install update-grub_SCRIPTS and update-grub_DATA.
* configure.ac: Add --enable-update-grub option to enable update-grub.
* configure: Regenerate.
* conf/common.rmk: Install update-grub components when enable_update_grub is set.
* conf/common.mk: Regenerate.
* util/update-grub.in: New. Core of update-grub.
* util/grub.d/00_header.in: New. Generates grub.cfg header.
* util/grub.d/10_hurd.in: New. Generates boot entries for the Hurd.
* util/grub.d/10_linux.in: New. Generates boot entries for Linux.
* util/grub.d/README: New. Document grub.d directory layout.
Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.38
DISTLIST +5 -0
@@ -258,6 +258,11 @@ util/raid.c util/resolve.c util/unifont2pff.rb +util/update-grub.in +util/grub.d/00_header.in +util/grub.d/10_hurd.in +util/grub.d/10_linux.in +util/grub.d/README util/i386/efi/grub-mkimage.c util/i386/pc/biosdisk.c util/i386/pc/getroot.c
Index: Makefile.in
===================================================================
RCS file: /sources/grub/grub2/Makefile.in,v
retrieving revision 1.24
Makefile.in +12 -0
@@ -77,6 +78,7 @@ # Options. enable_grub_emu = @enable_grub_emu@ +enable_update_grub = @enable_update_grub@ ### General variables.
@@ -153,6 +155,17 @@ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ done + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d + @list='$(update-grub_SCRIPTS)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done + @list='$(update-grub_DATA)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done install-strip: $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
Index: configure.ac
===================================================================
RCS file: /sources/grub/grub2/configure.ac,v
retrieving revision 1.37
configure.ac +13 -0
@@ -314,6 +314,19 @@ [fi] AC_SUBST([enable_grub_emu]) +AC_ARG_ENABLE([update-grub], + [AS_HELP_STRING([--enable-update-grub], + [build and install the `update-grub' grub.cfg generation utility])]) +[if [ x"$enable_update_grub" = xyes ]; then + # Check for bash.] + AC_PATH_PROG(_BASH, bash) # BASH is a reserved variable, use _BASH instead + if test "x$_BASH" = x; then + AC_MSG_ERROR([bash is required for `update-grub']) + fi + AC_CONFIG_FILES([util/update-grub util/grub.d/00_header util/grub.d/10_hurd util/grub.d/10_linux]) +[fi] +AC_SUBST([enable_update_grub]) + # Output files. AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu include/grub/machine:include/grub/$target_cpu/$platform])
Index: conf/common.mk
===================================================================
RCS file: /sources/grub/grub2/conf/common.mk,v
retrieving revision 1.20
common.mk +5 -0
@@ -18,6 +18,11 @@ rm -f $@; sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@ DISTCLEANFILES += grub_emu_init.c +ifeq ($(enable_update_grub), yes) +sbin_UTILITIES += util/update-grub +update-grub_SCRIPTS += util/grub.d/00_header util/grub.d/10_linux util/grub.d/10_hurd +update-grub_DATA += util/grub.d/README +endif # Filing systems. pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
Index: conf/common.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/common.rmk,v
retrieving revision 1.12
common.rmk +5 -0
@@ -18,6 +18,11 @@ rm -f $@; sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@ DISTCLEANFILES += grub_emu_init.c +ifeq ($(enable_update_grub), yes) +sbin_UTILITIES += util/update-grub +update-grub_SCRIPTS += util/grub.d/00_header util/grub.d/10_linux util/grub.d/10_hurd +update-grub_DATA += util/grub.d/README +endif # Filing systems. pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
Index: util/update-grub.in
===================================================================
RCS file: util/update-grub.in
update-grub.in new file +89 -0
89 lines not on this page · raw message
Index: util/grub.d/00_header.in
===================================================================
RCS file: util/grub.d/00_header.in
grub.d/00_header.in new file +28 -0
@@ -0,0 +1,28 @@ +#! @_BASH@ -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + +if [ -z "${GRUB_DEFAULT}" ] ; then GRUB_DEFAULT=0 ; fi +if [ -z "${GRUB_TIMEOUT}" ] ; then GRUB_TIMEOUT=5 ; fi + +cat << EOF +set default=${GRUB_DEFAULT} +set timeout=${GRUB_TIMEOUT} +set root=${GRUB_DRIVE} +EOF
Index: util/grub.d/10_hurd.in
===================================================================
RCS file: util/grub.d/10_hurd.in
grub.d/10_hurd.in new file +72 -0
72 lines not on this page · raw message
Index: util/grub.d/10_linux.in
===================================================================
RCS file: util/grub.d/10_linux.in
grub.d/10_linux.in new file +53 -0
53 lines not on this page · raw message
Index: util/grub.d/README
===================================================================
RCS file: util/grub.d/README
grub.d/README new file +11 -0
@@ -0,0 +1,11 @@ + +All executable files in this directory are processed in shell expansion order. + + 00_*: Reserved for 00_header. + 10_*: Native boot entries. + 20_*: Third party apps (e.g. memtest86+). + +The number namespace in-between is configurable by system installer and/or +administrator. For example, you can add an entry to boot another OS as +01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +the menu; and then adjust the default setting via /etc/default/grub.
Re: update-grub2 patch
Quoted 1 line · Robert Millan
Here's my patch. Let me know if it's ok for commit.
It looks OK. After commiting it we can start to try to push "plugins" for others like Xen.
Signature · 8 lines
O T A V I O S A L V A D O R --------------------------------------------- E-mail: [email protected] UIN: 5906116 GNU/Linux User: 239058 GPG ID: 49A5F855 Home Page: http://otavio.ossystems.com.br --------------------------------------------- "Microsoft sells you Windows ... Linux gives you the whole house."
Re: update-grub2 patch
In reply to Robert MillanQuoted 1 line · Robert Millan
Here's my patch. Let me know if it's ok for commit.
To include this in the official repository, you need to take care about the portability. You should not rely on the existence of some programs.
For instance, you use bash. This is not good. Use /bin/sh instead. You use shopt. This is not good, because this is specific to bash. The way in which you write test expressions is not very portable.
Also, don't use negations (i.e. `!'), because they don't behave correctly on some platforms. Use "if ... then else ..." instead.
For more information, please look at the chapter "Portable Shell Programming" in the Autoconf manual.
Regards,
Okuji
Re: update-grub2 patch
Quoted 5 lines · Yoshinori K. Okuji
Quoted 1 line · Robert Millan
Here's my patch. Let me know if it's ok for commit.
To include this in the official repository, you need to take care about the portability. [...]
I ported it to bourne shell. It's tested and known to work with dash as /bin/sh. I think this should address your concern.
My new patch also arranges the logic for generating update-grub components to make it more similar to how grub-install is handled.
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2007-04-30 Robert Millan <[email protected]>
* DISTLIST: Add util/update-grub.in, util/grub.d/00_header.in, util/grub.d/10_hurd.in, util/grub.d/10_linux.in and util/grub.d/README.
* Makefile.in: Build update-grub_SCRIPTS. Install update-grub_SCRIPTS and update-grub_DATA.
* conf/common.rmk: Build and install update-grub components.
* conf/common.mk: Regenerate.
* util/update-grub.in: New. Core of update-grub.
* util/grub.d/00_header.in: New. Generates grub.cfg header.
* util/grub.d/10_hurd.in: New. Generates boot entries for the Hurd.
* util/grub.d/10_linux.in: New. Generates boot entries for Linux.
* util/grub.d/README: New. Document grub.d directory layout.
Index: DISTLIST
===================================================================
RCS file: /sources/grub/grub2/DISTLIST,v
retrieving revision 1.38
DISTLIST +5 -0
@@ -258,6 +258,11 @@ util/raid.c util/resolve.c util/unifont2pff.rb +util/update-grub.in +util/grub.d/00_header.in +util/grub.d/10_hurd.in +util/grub.d/10_linux.in +util/grub.d/README util/i386/efi/grub-mkimage.c util/i386/pc/biosdisk.c util/i386/pc/getroot.c
Index: Makefile.in
===================================================================
RCS file: /sources/grub/grub2/Makefile.in,v
retrieving revision 1.24
Makefile.in +12 -1
@@ -87,7 +87,7 @@ DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ $(pkgdata_DATA) PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES) -SCRIPTS = $(sbin_SCRIPTS) +SCRIPTS = $(sbin_SCRIPTS) $(update-grub_SCRIPTS) CLEANFILES = MOSTLYCLEANFILES =
@@ -153,6 +153,17 @@ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ done + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d + @list='$(update-grub_SCRIPTS)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done + @list='$(update-grub_DATA)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done install-strip: $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
Index: conf/common.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/common.rmk,v
retrieving revision 1.12
common.rmk +27 -0
@@ -18,6 +18,33 @@ rm -f $@; sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@ DISTCLEANFILES += grub_emu_init.c +# For update-grub +update-grub: util/update-grub.in config.status + ./config.status --file=$@:$< + chmod +x $@ +sbin_SCRIPTS += update-grub +CLEANFILES += update-grub + +00_header: util/grub.d/00_header.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 00_header +CLEANFILES += 00_header + +10_linux: util/grub.d/10_linux.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 10_linux +CLEANFILES += 10_linux + +10_hurd: util/grub.d/10_hurd.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 10_hurd +CLEANFILES += 10_hurd + +update-grub_DATA += util/grub.d/README + # Filing systems. pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
Index: util/update-grub.in
===================================================================
RCS file: util/update-grub.in
update-grub.in new file +94 -0
94 lines not on this page · raw message
Index: util/grub.d/00_header.in
===================================================================
RCS file: util/grub.d/00_header.in
grub.d/00_header.in new file +28 -0
@@ -0,0 +1,28 @@ +#! /bin/sh -e + +# update-grub helper script. +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + +if [ -z "${GRUB_DEFAULT}" ] ; then GRUB_DEFAULT=0 ; fi +if [ -z "${GRUB_TIMEOUT}" ] ; then GRUB_TIMEOUT=5 ; fi + +cat << EOF +set default=${GRUB_DEFAULT} +set timeout=${GRUB_TIMEOUT} +set root=${GRUB_DRIVE} +EOF
Index: util/grub.d/10_hurd.in
===================================================================
RCS file: util/grub.d/10_hurd.in
grub.d/10_hurd.in new file +72 -0
72 lines not on this page · raw message
Index: util/grub.d/10_linux.in
===================================================================
RCS file: util/grub.d/10_linux.in
grub.d/10_linux.in new file +54 -0
54 lines not on this page · raw message
Index: util/grub.d/README
===================================================================
RCS file: util/grub.d/README
grub.d/README new file +11 -0
@@ -0,0 +1,11 @@ + +All executable files in this directory are processed in shell expansion order. + + 00_*: Reserved for 00_header. + 10_*: Native boot entries. + 20_*: Third party apps (e.g. memtest86+). + +The number namespace in-between is configurable by system installer and/or +administrator. For example, you can add an entry to boot another OS as +01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +the menu; and then adjust the default setting via /etc/default/grub.
Re: update-grub2 patch
Quoted 4 lines · Robert Millan
Quoted 3 lines · Yoshinori K. Okuji
Quoted 1 line · Robert Millan
Here's my patch. Let me know if it's ok for commit.
Quoted 8 lines
Quoted 2 lines
To include this in the official repository, you need to take care about the portability. [...]
I ported it to bourne shell. It's tested and known to work with dash as
/bin/sh. I think this should address your concern.My new patch also arranges the logic for generating update-grub components to make it more similar to how grub-install is handled.
Some issues are still there. You should avoid test -z. Instead, use test x$foo = x. You should avoid ! in test. Use else instead. You should avoid using which. Travese $PATH instead.
Okuji
Re: update-grub2 patch
Quoted 8 lines · Yoshinori K. Okuji
Quoted 7 lines · Robert Millan
Quoted 5 lines · Yoshinori K. Okuji
Quoted 1 line · Robert Millan
Here's my patch. Let me know if it's ok for commit.
To include this in the official repository, you need to take care about the portability. [...]
Quoted 8 lines
Quoted 5 lines
I ported it to bourne shell. It's tested and known to work with dash as
/bin/sh. I think this should address your concern.My new patch also arranges the logic for generating update-grub components to make it more similar to how grub-install is handled.
Some issues are still there. You should avoid test -z. Instead, use test x$foo = x.
Ok
Quoted 1 line
You should avoid ! in test. Use else instead.
Earlier when I read the portability document I was pointed to, I found:
"You may use !' with test', but not with `if'"
Are you sure this change is required?
Quoted 2 lines
You should avoid using
which. Travese $PATH instead.
Do you mean something like:
IFS=:
for i in $PATH ; do
grub-probe="$i/grub-probe"
if test -x $grub-probe ; then break ; fi
done
?
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
Re: update-grub2 patch
* Robert Millan wrote, On 02/05/07 14:31:
Quoted 8 lines
Do you mean something like:
IFS=:
for i in $PATH ; do
grub-probe="$i/grub-probe"
if test -x $grub-probe ; then break ; fi
done
You may as well define your own which:
which() {
IFS=:
for i in $PATH ; do
if test -x "$i/$1"
then echo "$i/$1"
return
fi
done
return 1
}
then you can keep on using which
Sam
Re: update-grub2 patch
In reply to Robert MillanQuoted 7 lines · Robert Millan
Quoted 1 line
You should avoid ! in test. Use else instead.
Earlier when I read the portability document I was pointed to, I found:
"You may use
!' withtest', but not with `if'"Are you sure this change is required?
Well, since this is just one line, I fixed it.
Attached new patch fixes all three problems ('which', 'test !' and 'test -z|-n') and also adds code in 00_header.in to enable gfxterm when the unicode font is found in /boot/grub.
Let me know if everything is ok now..
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.
2007-05-03 Robert Millan <[email protected]>
* DISTLIST: Add util/update-grub.in, util/grub.d/00_header.in, util/grub.d/10_hurd.in, util/grub.d/10_linux.in and util/grub.d/README.
* Makefile.in: Build update-grub_SCRIPTS. Install update-grub_SCRIPTS and update-grub_DATA.
* conf/common.rmk: Build and install update-grub components.
* conf/common.mk: Regenerate.
* util/update-grub.in: New. Core of update-grub.
* util/grub.d/00_header.in: New. Generates grub.cfg header.
* util/grub.d/10_hurd.in: New. Generates boot entries for the Hurd.
* util/grub.d/10_linux.in: New. Generates boot entries for Linux.
* util/grub.d/README: New. Document grub.d directory layout.
conf/common.rmk +27 -0
@@ -18,6 +18,33 @@ rm -f $@; sh $(srcdir)/geninit.sh $(filter %.c,$^) > $@ DISTCLEANFILES += grub_emu_init.c +# For update-grub +update-grub: util/update-grub.in config.status + ./config.status --file=$@:$< + chmod +x $@ +sbin_SCRIPTS += update-grub +CLEANFILES += update-grub + +00_header: util/grub.d/00_header.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 00_header +CLEANFILES += 00_header + +10_linux: util/grub.d/10_linux.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 10_linux +CLEANFILES += 10_linux + +10_hurd: util/grub.d/10_hurd.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 10_hurd +CLEANFILES += 10_hurd + +update-grub_DATA += util/grub.d/README + # Filing systems. pkgdata_MODULES += fshelp.mod fat.mod ufs.mod ext2.mod \
DISTLIST +5 -0
@@ -258,6 +258,11 @@ util/raid.c util/resolve.c util/unifont2pff.rb +util/update-grub.in +util/grub.d/00_header.in +util/grub.d/10_hurd.in +util/grub.d/10_linux.in +util/grub.d/README util/i386/efi/grub-mkimage.c util/i386/pc/biosdisk.c util/i386/pc/getroot.c
Makefile.in +12 -1
@@ -87,7 +87,7 @@ DATA = $(pkgdata_IMAGES) $(pkgdata_MODULES) $(pkgdata_PROGRAMS) \ $(pkgdata_DATA) PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES) -SCRIPTS = $(sbin_SCRIPTS) +SCRIPTS = $(sbin_SCRIPTS) $(update-grub_SCRIPTS) CLEANFILES = MOSTLYCLEANFILES =
@@ -153,6 +153,17 @@ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ done + $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d + @list='$(update-grub_SCRIPTS)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done + @list='$(update-grub_DATA)'; for file in $$list; do \ + if test -f "$$file"; then dir=; else dir="$(srcdir)"; fi; \ + dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ + $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ + done install-strip: $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install
util/grub.d/00_header.in +38 -0
@@ -0,0 +1,38 @@ +#! /bin/sh -e + +# update-grub helper script. +# Copyright (C) 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St - Suite 330, Boston, MA 02110, USA. + + +if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi +if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi + +cat << EOF +set default=${GRUB_DEFAULT} +set timeout=${GRUB_TIMEOUT} +set root=${GRUB_DRIVE} +EOF + +if test -e /boot/grub/unifont.pff ; then + cat << EOF +font /boot/grub/unifont.pff +set gfxmode=640x480x32 +insmod gfxterm +insmod vbe +terminal gfxterm +EOF +fi
util/grub.d/10_hurd.in +72 -0
72 lines not on this page · raw message
util/grub.d/10_linux.in +59 -0
59 lines not on this page · raw message
util/grub.d/README +11 -0
@@ -0,0 +1,11 @@ + +All executable files in this directory are processed in shell expansion order. + + 00_*: Reserved for 00_header. + 10_*: Native boot entries. + 20_*: Third party apps (e.g. memtest86+). + +The number namespace in-between is configurable by system installer and/or +administrator. For example, you can add an entry to boot another OS as +01_otheros, 11_otheros, etc, depending on the position you want it to occupy in +the menu; and then adjust the default setting via /etc/default/grub.
util/update-grub.in +106 -0
106 lines not on this page · raw message
Re: update-grub2 patch
Quoted 9 lines · Robert Millan
Quoted 7 lines · Robert Millan
Quoted 1 line
You should avoid ! in test. Use else instead.
Earlier when I read the portability document I was pointed to, I found:
"You may use
!' withtest', but not with `if'"Are you sure this change is required?
Quoted 7 lines
Well, since this is just one line, I fixed it.
Attached new patch fixes all three problems ('which', 'test !' and 'test -z|-n') and also adds code in 00_header.in to enable gfxterm when the unicode font is found in
/boot/grub.Let me know if everything is ok now..
OK. Please go ahead.
Thanks,
Okuji
Re: update-grub2 patch
Quoted 12 lines · Yoshinori K. Okuji
Quoted 11 lines · Robert Millan
Quoted 7 lines · Robert Millan
Quoted 1 line
You should avoid ! in test. Use else instead.
Earlier when I read the portability document I was pointed to, I found:
"You may use
!' withtest', but not with `if'"Are you sure this change is required?
Well, since this is just one line, I fixed it.
Quoted 7 lines
Quoted 5 lines
Attached new patch fixes all three problems ('which', 'test !' and 'test -z|-n') and also adds code in 00_header.in to enable gfxterm when the unicode font is found in
/boot/grub.Let me know if everything is ok now..
OK. Please go ahead.
Done!
Signature · 4 lines
Robert Millan My spam trap is [email protected]. Note: this address is only intended for spam harvesters. Writing to it will get you added to my black list.