Date: Tuesday, March 16, 2010 @ 09:09:35 Author: ronald Revision: 72454
upgpkg: grub2 1.98-1 bump to latest version; set default colors same as grub1 theme; patch grub-mkconfig to autodetect Arch kernels Added: grub2/trunk/grubconfig.archlinux.patch Modified: grub2/trunk/PKGBUILD grub2/trunk/grub2.install Deleted: grub2/trunk/grub.cfg grub2/trunk/install-grub ----------------------------+ PKGBUILD | 25 ++--- grub.cfg | 32 ------- grub2.install | 10 +- grubconfig.archlinux.patch | 73 ++++++++++++++++ install-grub | 187 ------------------------------------------- 5 files changed, 91 insertions(+), 236 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2010-03-16 10:35:03 UTC (rev 72453) +++ PKGBUILD 2010-03-16 13:09:35 UTC (rev 72454) @@ -3,7 +3,7 @@ # Contributor: dongiovanni <dongiovanni.archlinux.de> pkgname=grub2 -pkgver=1.97.2 +pkgver=1.98 pkgrel=1 pkgdesc="The GNU GRand Unified Bootloader" url="http://www.gnu.org/software/grub/" @@ -14,20 +14,21 @@ makedepends=('bdf-unifont' 'ruby') conflicts=('grub') provides=('grub') -backup=('boot/grub/grub.cfg') install=${pkgname}.install source=(ftp://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.gz - # use our own svn checkout so disable snapshot - #ftp://ftp.archlinux.org/sources/${pkgname}-${pkgver}.src.tar.bz2 - 'grub.cfg') -# don't install auto-install script. TODO: It needs a rewrite to work with grub2 -# 'install-grub') -md5sums=('db4d23fb8897523a7e484e974ae3d1c9' - '743215998a581a54ac77630f0db222ce') + 'grubconfig.archlinux.patch') +md5sums=('c0bcf60e524739bb64e3a2d4e3732a59' + '16a1d27f2e0e6bcb415e3f5b52ec2b78') build() { - cd $srcdir/grub-${pkgver} + cd $srcdir/grub-${pkgver}/util/grub.d + + # modify scripts to detect Arch Linux kernels & set custom default colors + patch -Np3 -i ${srcdir}/grubconfig.archlinux.patch || return 1 + + # run autogen.sh to create configure files + cd ../.. ./autogen.sh # fix unifont.bdf location @@ -39,9 +40,5 @@ CFLAGS= make || return 1 make DESTDIR=${pkgdir} install || return 1 - - install -Dm644 ${srcdir}/grub.cfg $startdir/pkg/boot/grub/grub.cfg - #install -Dm755 ${srcdir}/install-grub $startdir/pkg/sbin/install-grub } - Deleted: grub.cfg =================================================================== --- grub.cfg 2010-03-16 10:35:03 UTC (rev 72453) +++ grub.cfg 2010-03-16 13:09:35 UTC (rev 72454) @@ -1,32 +0,0 @@ -# Config file for GRUB2 - The GNU GRand Unified Bootloader -# /boot/grub/grub.cfg - -# DEVICE NAME CONVERSIONS -# -# Linux Grub -# ------------------------- -# /dev/fd0 (fd0) -# /dev/sda (hd0) -# /dev/sdb2 (hd1,2) -# /dev/sda3 (hd0,3) -# - -# Timeout for menu -set timeout=5 - -# Set default boot entry as Entry 0 -set default=0 - -# (0) Arch Linux -menuentry "Arch Linux" { -set root=(hd0,1) -linux /vmlinuz26 root=/dev/sda1 ro -initrd /kernel26.img -} - -## (1) Windows -#menuentry "Windows" { -#set root=(hd0,3) -#chainloader +1 -#} - Modified: grub2.install =================================================================== --- grub2.install 2010-03-16 10:35:03 UTC (rev 72453) +++ grub2.install 2010-03-16 13:09:35 UTC (rev 72454) @@ -1,13 +1,17 @@ post_install() { + echo -n "Generating grub.cfg config file... " + grub-mkconfig -o /boot/grub/grub.cfg 2> /dev/null + echo "done." + cat << EOF + Please verify the config file installed in /boot/grub/grub.cfg + For more information and additional config settings please see http://wiki.archlinux.org/index.php/GRUB2 GRUB2 is still expiremental and under heavy development!. Only install it if you know what you are doing. - GRUB2 has a different configuration then GRUB legacy." - Look at http://wiki.archlinux.org/index.php/GRUB2 for more information." +EOF -EOF } post_upgrade() { Added: grubconfig.archlinux.patch =================================================================== --- grubconfig.archlinux.patch (rev 0) +++ grubconfig.archlinux.patch 2010-03-16 13:09:35 UTC (rev 72454) @@ -0,0 +1,73 @@ +diff -Naur /etc/grub.d.orig/00_header /etc/grub.d/00_header +--- /etc/grub.d.orig/00_header.in 2010-03-16 12:05:22.998499105 +0100 ++++ /etc/grub.d/00_header.in 2010-03-16 13:01:21.018170738 +0100 +@@ -120,6 +120,8 @@ + ;; + x) + # Just use the native terminal ++set menu_color_normal=light-blue/black ++set menu_color_highlight=light-cyan/blue + ;; + x*) + cat << EOF +diff -Naur /etc/grub.d.orig/05_archtheme /etc/grub.d/05_archtheme +--- /etc/grub.d.orig/05_archtheme.in 1970-01-01 01:00:00.000000000 +0100 ++++ /etc/grub.d/05_archtheme.in 2010-03-16 13:05:59.878411766 +0100 +@@ -0,0 +1,6 @@ ++#!/bin/bash -e ++ ++cat << EOF ++set menu_color_normal=light-blue/black ++set menu_color_highlight=light-cyan/blue ++EOF +diff -Naur /etc/grub.d.orig/10_linux /etc/grub.d/10_linux +--- /etc/grub.d.orig/10_linux.in 2010-03-16 12:05:22.998499105 +0100 ++++ /etc/grub.d/10_linux.in 2010-03-16 13:26:36.669907054 +0100 +@@ -28,10 +28,10 @@ + CLASS="--class gnu-linux --class gnu --class os" + + if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then +- OS=GNU/Linux ++ OS="Arch Linux" + else +- OS="${GRUB_DISTRIBUTOR} GNU/Linux" +- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}" ++ OS="${GRUB_DISTRIBUTOR} Arch Linux" ++ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' ) ${CLASS}" + fi + + # loop-AES arranges things so that /dev/loop/X can be our root device, but +@@ -46,7 +46,7 @@ + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} + else +- LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} ++ LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" + fi + + linux_entry () +@@ -97,11 +97,12 @@ + EOF + } + +-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do ++list=`for i in /boot/vmlinu[xz]* /vmlinu[xz]* ; do + if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi + done` + prepare_boot_cache= + ++ + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` + echo "Found linux image: $linux" >&2 +@@ -113,9 +114,7 @@ + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + + initrd= +- for i in "initrd.img-${version}" "initrd-${version}.img" \ +- "initrd-${version}" "initrd.img-${alt_version}" \ +- "initrd-${alt_version}.img" "initrd-${alt_version}"; do ++ for i in "$(echo $basename|sed 's|vmlinuz|kernel|'|sed 's|$|.img|')"; do + if test -e "${dirname}/${i}" ; then + initrd="$i" + break Deleted: install-grub =================================================================== --- install-grub 2010-03-16 10:35:03 UTC (rev 72453) +++ install-grub 2010-03-16 13:09:35 UTC (rev 72454) @@ -1,187 +0,0 @@ -#!/bin/bash - -# -# This is a little helper script that tries to convert linux-style device -# names to grub-style. It's not very smart, so it -# probably won't work for more complicated setups. -# -# If it doesn't work for you, try installing grub manually: -# -# # mkdir -p /boot/grub -# # cp /usr/lib/grub/i386-pc/* /boot/grub/ -# -# Then start up the 'grub' shell and run something like the following: -# -# grub> root(hd0,0) -# grub> setup(hd0) -# -# The "root" line should point to the partition your kernel is located on, -# /boot if you have a separate boot partition, otherwise your root (/). -# -# The "setup" line tells grub which disc/partition to install the -# bootloader to. In the example above, it will install to the MBR of the -# primary master hard drive. -# - -usage() { - echo "usage: install-grub <install_device> [boot_device]" - echo - echo "where <install_device> is the device where Grub will be installed" - echo "and [boot_device] is the partition that contains the /boot" - echo "directory (auto-detected if omitted)" - echo - echo "examples: install-grub /dev/hda" - echo " install-grub /dev/hda /dev/hda1" - echo - exit 0 -} - -## new install-grub, code was taken from setup script -ROOTDEV=$1 -PART_ROOT=$2 -VMLINUZ=vmlinuz26 - -if [ "$ROOTDEV" = "" ]; then - usage -fi -if [ "$PART_ROOT" = "" ]; then - PART_ROOT=$(mount | grep "on /boot type" | cut -d' ' -f 1) -fi -if [ "$PART_ROOT" = "" ]; then - PART_ROOT=$(mount | grep "on / type" | cut -d' ' -f 1) -fi -if [ "$PART_ROOT" = "" ]; then - echo "error: could not determine BOOT_DEVICE, please specify manually" >&2 - exit 1 -fi - - -get_grub_map() { - [ -e /tmp/dev.map ] && rm /tmp/dev.map - /sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF -quit -EOF -} - -mapdev() { - partition_flag=0 - device_found=0 - devs=$(cat /tmp/dev.map | grep -v fd | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g') - linuxdevice=$(echo $1 | cut -b1-8) - if [ "$(echo $1 | egrep '[0-9]$')" ]; then - # /dev/hdXY - pnum=$(echo $1 | cut -b9-) - pnum=$(($pnum-1)) - partition_flag=1 - fi - for dev in $devs - do - if [ "(" = $(echo $dev | cut -b1) ]; then - grubdevice="$dev" - else - if [ "$dev" = "$linuxdevice" ]; then - device_found=1 - break - fi - fi - done - if [ "$device_found" = "1" ]; then - if [ "$partition_flag" = "0" ]; then - echo "$grubdevice" - else - grubdevice_stringlen=${#grubdevice} - let grubdevice_stringlen-- - grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen) - echo "$grubdevice,$pnum)" - fi - else - echo " DEVICE NOT FOUND" - fi -} - -dogrub() { - get_grub_map - if [ ! -f /boot/grub/menu.lst ]; then - echo "Error: Couldn't find /boot/grub/menu.lst. Is GRUB installed?" - exit 1 - fi - # try to auto-configure GRUB... - if [ "$PART_ROOT" != "" -a "$S_GRUB" != "1" ]; then - grubdev=$(mapdev $PART_ROOT) - # look for a separately-mounted /boot partition - bootdev=$(mount | grep /boot | cut -d' ' -f 1) - if [ "$grubdev" != "" -o "$bootdev" != "" ]; then - cp /boot/grub/menu.lst /tmp/.menu.lst - # remove the default entries by truncating the file at our little tag (#-*) - head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >/boot/grub/menu.lst - rm -f /tmp/.menu.lst - echo "" >>/boot/grub/menu.lst - echo "# (0) Arch Linux" >>/boot/grub/menu.lst - echo "title Arch Linux" >>/boot/grub/menu.lst - subdir= - if [ "$bootdev" != "" ]; then - grubdev=$(mapdev $bootdev) - else - subdir="/boot" - fi - echo "root $grubdev" >>/boot/grub/menu.lst - echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst - if [ "$VMLINUZ" = "vmlinuz26" ]; then - echo "initrd $subdir/kernel26.img" >>/boot/grub/menu.lst - fi - echo "" >>/boot/grub/menu.lst - # adding fallback/full image - echo "# (1) Arch Linux" >>/boot/grub/menu.lst - echo "title Arch Linux Fallback" >>/boot/grub/menu.lst - echo "root $grubdev" >>/boot/grub/menu.lst - echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst - if [ "$VMLINUZ" = "vmlinuz26" ]; then - echo "initrd $subdir/kernel26-fallback.img" >>/boot/grub/menu.lst - fi - echo "" >>/boot/grub/menu.lst - fi - fi - - echo "Installing the GRUB bootloader..." - cp -a /usr/lib/grub/i386-pc/* /boot/grub/ - sync - # freeze xfs filesystems to enable grub installation on xfs filesystems - if [ -x /usr/sbin/xfs_freeze ]; then - /usr/sbin/xfs_freeze -f /boot > /dev/null 2>&1 - /usr/sbin/xfs_freeze -f / > /dev/null 2>&1 - fi - # look for a separately-mounted /boot partition - bootpart=$(mount | grep /boot | cut -d' ' -f 1) - if [ "$bootpart" = "" ]; then - bootpart=$PART_ROOT - fi - bootpart=$(mapdev $bootpart) - bootdev=$(mapdev $ROOTDEV) - if [ "$bootpart" = "" ]; then - echo "Error: Missing/Invalid root device: $bootpart" - exit 1 - fi - /sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF -root $bootpart -setup $bootdev -quit -EOF -cat /tmp/grub.log - # unfreeze xfs filesystems - if [ -x /usr/sbin/xfs_freeze ]; then - /usr/sbin/xfs_freeze -u /boot > /dev/null 2>&1 - /usr/sbin/xfs_freeze -u / > /dev/null 2>&1 - fi - - if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then - echo "Error installing GRUB. (see /tmp/grub.log for output)" - exit 1 - fi - echo "GRUB was successfully installed." - -rm -f /tmp/grub.log - -exit 0 -} - -dogrub \ No newline at end of file