2007-05-13 Robert Millan <rmh@aybabtu.com>
* util/update-grub.in: Fix a few assumptions about the devices holding /, /boot and /boot/grub being the same. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/grub.d/10_linux.in: Implement Linux image sorting with arbitrary patterns. Use that to define the `.old' suffix as older than `'. * util/grub.d/00_header.in: Set default gfxmode to `800x600x16'. * util/update-grub.in: Add a reference to ${sysconfdir}/default/grub in the grub.cfg header message.
This commit is contained in:
parent
2e610d6273
commit
57f9639766
5 changed files with 134 additions and 27 deletions
|
@ -29,8 +29,9 @@ EOF
|
|||
|
||||
if test -e /boot/grub/unifont.pff ; then
|
||||
cat << EOF
|
||||
font /boot/grub/unifont.pff
|
||||
set gfxmode=640x480x32
|
||||
|
||||
font ${GRUB_DRIVE_BOOT_GRUB}/unifont.pff
|
||||
set gfxmode=800x600x16
|
||||
insmod gfxterm
|
||||
insmod vbe
|
||||
terminal gfxterm
|
||||
|
|
|
@ -23,11 +23,19 @@ else
|
|||
OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
|
||||
fi
|
||||
|
||||
at_least_one=false
|
||||
all_of_them=true
|
||||
|
||||
# FIXME: add l4 here?
|
||||
kernel=
|
||||
for i in /boot/gnumach.gz /boot/gnumach ; do
|
||||
if test -e $i ; then
|
||||
kernel=$i
|
||||
basename=`basename $i`
|
||||
dirname=`dirname $i`
|
||||
grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
|
||||
echo "Found GNU Mach: $i" >&2
|
||||
kernel=${grub_dirname}/${basename}
|
||||
at_least_one=true
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -37,10 +45,8 @@ case "${GRUB_FS}" in
|
|||
*) 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
|
||||
for i in /hurd/${hurd_fs}.static /hurd/exec ; do
|
||||
if test -e "$i" ; then
|
||||
echo "Found Hurd module: $i" >&2
|
||||
at_least_one=true
|
||||
else
|
||||
|
|
|
@ -23,22 +23,76 @@ else
|
|||
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
fi
|
||||
|
||||
|
||||
for linux in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
||||
if test -e ${linux} ; then : ; else
|
||||
continue
|
||||
test_numeric ()
|
||||
{
|
||||
local a=$1
|
||||
local cmp=$2
|
||||
local b=$3
|
||||
if [ "$a" = "$b" ] ; then
|
||||
case $cmp in
|
||||
ge|eq|le) return 0 ;;
|
||||
gt|lt) return 1 ;;
|
||||
esac
|
||||
fi
|
||||
echo "Found linux image: $linux" >&2
|
||||
version=`echo $linux | sed -e "s,.*/[^0-9]*-,,g"`
|
||||
basedir=`echo $linux | sed -e "s,/[^/]*$,,g"`
|
||||
if [ "$cmp" = "lt" ] ; then
|
||||
c=$a
|
||||
a=$b
|
||||
b=$c
|
||||
fi
|
||||
if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_gt ()
|
||||
{
|
||||
local a=$1
|
||||
local b=$2
|
||||
local cmp=gt
|
||||
if [ "x$b" = "x" ] ; then
|
||||
return 0
|
||||
fi
|
||||
case $a:$b in
|
||||
*.old:*.old) ;;
|
||||
*.old:*) a=`echo -n $a | sed -e s/\.old$//g` ; cmp=gt ;;
|
||||
*:*.old) b=`echo -n $b | sed -e s/\.old$//g` ; cmp=ge ;;
|
||||
esac
|
||||
test_numeric $a $cmp $b
|
||||
return $?
|
||||
}
|
||||
|
||||
find_latest ()
|
||||
{
|
||||
local a=""
|
||||
for i in $@ ; do
|
||||
if test_gt "$i" "$a" ; then
|
||||
a="$i"
|
||||
fi
|
||||
done
|
||||
echo "$a"
|
||||
}
|
||||
|
||||
list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
|
||||
if test -e $i ; then echo -n "$i " ; fi
|
||||
done`
|
||||
|
||||
while [ "x$list" != "x" ] ; do
|
||||
linux=`find_latest $list`
|
||||
echo "Found linux image: $linux" >&2
|
||||
basename=`basename $linux`
|
||||
dirname=`dirname $linux`
|
||||
grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
|
||||
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
|
||||
cat << EOF
|
||||
menuentry "${OS}, linux ${version}" {
|
||||
linux ${linux} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX}
|
||||
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX}
|
||||
EOF
|
||||
if test -e ${basedir}/initrd.img-${version} ; then
|
||||
echo "Found initrd image: ${basedir}/initrd.img-${version}" >&2
|
||||
if test -e ${dirname}/initrd.img-${version} ; then
|
||||
echo "Found initrd image: ${dirname}/initrd.img-${version}" >&2
|
||||
cat << EOF
|
||||
initrd ${basedir}/initrd.img-${version}
|
||||
initrd ${grub_dirname}/initrd.img-${version}
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
|
@ -46,14 +100,15 @@ EOF
|
|||
EOF
|
||||
cat << EOF
|
||||
menuentry "${OS}, linux ${version} (single-user mode)" {
|
||||
linux ${linux} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
|
||||
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
|
||||
EOF
|
||||
if test -e ${basedir}/initrd.img-${version} ; then
|
||||
if test -e ${dirname}/initrd.img-${version} ; then
|
||||
cat << EOF
|
||||
initrd ${basedir}/initrd.img-${version}
|
||||
initrd ${grub_dirname}/initrd.img-${version}
|
||||
EOF
|
||||
fi
|
||||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue