Major rework of the grub2 PKGBUILD and upgrade to version 2.00.

Also merged back the grub2-efi-x64 package into this PKGBUILD.
The apparent reason for Arch Linux to split it in the first seems to be the ability to break the build on i686 machines for grub-efi-x64 only.
I think this is wrong: the right way to do this is make PKGBUILD ready to build and package it, but actually do it only if the machine architecture is 'x86_64'.
This commit is contained in:
Daniele 2012-07-15 05:07:31 +02:00
parent 6d0bb221bd
commit e09433b517
4 changed files with 324 additions and 348 deletions

View File

@ -1,219 +1,250 @@
#
# Core Packages for Chakra, part of chakra-project.org
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dot]org
# maintainer (x86_64): Daniele Cocca <jmc[at]chakra-project[dot]org>
# Maintainer: Daniele Cocca <jmc@chakra-project.org>
# The src pkg includes grub2_bzr_export.sh to create newer grub-extras snapshots. Modify the paths in it accordingly.
pkgname=('grub2-common' 'grub2-bios' 'grub2-efi32')
pkgbase=grub2
# _grub2_rev=3238
if [ "${CARCH}" == 'x86_64' ]; then
pkgname+=('grub2-efi64')
fi
_grub2_lua_ver=20
_grub2_gpxe_ver=12
_grub2_ntldr_ver=17
_grub2_915_ver=7
pkgname=('grub2-common' 'grub2-bios' 'grub2-efi-x32')
pkgbase="grub2"
pkgver='1.99'
pkgrel=9
url="http://www.gnu.org/software/grub/"
pkgver=2.00
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/grub/"
license=('GPL3')
epoch=1
makedepends=('bdf-unifont' 'python2' 'xz' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper')
options=(strip purge docs zipman !emptydirs)
# "http://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
source=("ftp://ftp.gnu.org/gnu/grub/grub-1.99.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz"
'chakra_grub2_mkconfig_fixes.patch'
'resume-hook.patch'
makedepends=('xz' 'bdf-unifont' 'ttf-dejavu' 'python' 'autogen'
'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse'
'bzr')
source=("ftp://ftp.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
'chakra_grub2_fixes.patch'
'grub.default'
'20_memtest86+'
'grub2_bzr_export.sh'
'update-grub')
md5sums=('a1043102fbc7bcedbf53e7ee3d17ab91'
'bc191bc9e298380c1d5995c0faafa75a'
'31e4c7414cef3db3fb26c40ac8da97f2'
'5a07e04c4ecb8ed145d54fec3043e0d5'
'9910bdfd42fa7d3e21e6961bfcc977f9')
noextract=("grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz")
# Options common to all packages
_common_options=('--prefix=/usr'
'--sysconfdir=/etc'
'--program-prefix='
"--host=${CARCH}-unknown-linux-gnu"
'--disable-werror'
'--enable-mm-debug'
'--enable-nls'
'--enable-device-mapper'
'--enable-cache-stats'
'--enable-grub-mkfont'
'--enable-grub-mount')
sha1sums=('a5ae9558f30ce7757a76aa130088b053a87e2fb6'
'd21ca5033f7069cbb36934cdb71f57a1c7829234'
'6c58eee654fa4eb7f057275b330710ffd4a9e989'
'0e50955141a45918fcf56f3a5e15fb477f0448a7'
'f2a5f1d5b75bd3286b63aefaf5e6553aa03e772b'
'3424cf1c43be5145e3b6be9e32c9217f07658a9a'
'af049daee1a93590ac13e73bbfb8b778f89ca1fb'
'01d35b970b672731c6cd4e05975adad11a3f6491'
'82a27eca5277218cf57c6c5767e0b17a72f62229'
'beb31419045db70fee7401aa6448c220a491e2a3'
'5770fbb559b1f463e1a735a1463d24af489bcc3e')
if [ "${CARCH}" == 'x86_64' ]; then
_native_arch='x86_64'
else
_native_arch='i386'
fi
# External sources
_grub_extras='http://bzr.savannah.gnu.org/r/grub-extras'
# Build code
_build_dir() {
[ $# -lt 1 ] && return false
mkdir -p "${1}" && cd "${1}"
}
_build_prepare() {
msg2 "Fixing font paths in ./configure..."
sed -e 's,\(/usr/share/fonts/unifont\),\1 /usr/share/fonts/misc,g' \
-i "${srcdir}/grub-${pkgver}/configure"
sed -e 's,\(/usr/share/fonts/dejavu\),\1 /usr/share/fonts/TTF,g' \
-i "${srcdir}/grub-${pkgver}/configure"
msg2 "Done replacing."
msg2 "Applying patches..."
cd "${srcdir}/grub-${pkgver}"
patch -Np1 -i "${srcdir}/chakra_grub2_fixes.patch" || return 1
msg2 "Done patching."
msg2 "Cloning the grub-extras repositories..."
export GRUB_CONTRIB="${srcdir}/grub-${_pkgver}/grub-extras/"
_build_dir "grub-extras"
for branch in "lua" "zfs" "gpxe" "ntldr-img" "915resolution"; do
if ! bzr revno "${branch}" &>/dev/null; then
bzr branch "${_grub_extras}/${branch}" || return 1
else
bzr update "${branch}" || return 1
fi
done
msg2 "Done cloning."
}
_build_grub2-bios() {
cd "${srcdir}"
_build_dir "build-grub2-bios"
"${srcdir}/grub-${pkgver}/configure" \
"${_common_options[@]}" \
--with-platform="pc" \
--target="${_native_arch}" \
|| return 1
make
}
_build_grub2-efi32() {
cd "${srcdir}"
_build_dir "build-grub2-efi32"
"${srcdir}/grub-${pkgver}/configure" \
"${_common_options[@]}" \
--with-platform="efi" \
--disable-efiemu \
--target="i386" \
|| return 1
make
}
_build_grub2-efi64() {
cd "${srcdir}"
_build_dir "build-grub2-efi64"
"${srcdir}/grub-${pkgver}/configure" \
"${_common_options[@]}" \
--with-platform="efi" \
--disable-efiemu \
--target="x86_64" \
|| return 1
make
}
build() {
# set architecture dependent variables
_HOST="${CARCH}"
[ "${CARCH}" = 'i686' ] && _EFIEMU="--disable-efiemu"
[ "${CARCH}" = 'x86_64' ] && _EFIEMU="--enable-efiemu"
_build_prepare || return 1
_build_grub2-bios || return 1
_build_grub2-efi32 || return 1
build_grub2-common_and_bios
build_grub2-efi
}
build_grub2-common_and_bios() {
# copy the source for building the common/bios package
cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub2_bios-${pkgver}"
## Apply Chakra specific fixes to enable grub2-mkconfig detect Chakra kernels and initramfs
cd "${srcdir}/grub2_bios-${pkgver}"
patch -Np1 -i "${srcdir}/chakra_grub2_mkconfig_fixes.patch"
# add the grub-extra sources
export GRUB_CONTRIB="${srcdir}/grub2_bios-${pkgver}/grub2-extras"
install -d "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
cd "${srcdir}/grub2_bios-${pkgver}"
## Need to use python2
sed -i 's|python|python2|' autogen.sh
# start the actual build process
./autogen.sh
## fix unifont.bdf location so grub-mkfont can create *.pf2 files
sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' configure
# mkdir ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
# cd ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
CFLAGS="" ./configure \
--with-platform=pc --enable-mm-debug \
"${_EFIEMU}" --host="${CARCH}-unknown-linux-gnu" \
--enable-grub-mkfont --prefix=/usr \
--bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info \
--sysconfdir=/etc --enable-nls \
--program-transform-name=s,grub,grub,
CFLAGS="" make
}
build_grub2-efi() {
# copy the source for building the efi package
cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub2_efi-${pkgver}"
# add the grub-extra sources
export GRUB_CONTRIB="${srcdir}/grub2_efi-${pkgver}/grub2-extras"
install -d "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz" \
-C "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz" \
-C "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
cd "${srcdir}/grub2_efi-${pkgver}"
## Need to use python2
sed -i 's|python|python2|' autogen.sh
# start the actual build process
./autogen.sh
CFLAGS="" ./configure \
--with-platform=efi --target=i386 \
--enable-mm-debug --disable-efiemu \
--host="${CARCH}-unknown-linux-gnu" \
--prefix=/usr --bindir=/bin \
--sbindir=/sbin --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc \
--enable-nls --program-transform-name=s,grub,grub,
CFLAGS="" make
if [ "${CARCH}" == 'x86_64' ]; then
_build_grub2-efi64 || return 1
fi
}
package_grub2-common() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Files common for all platforms"
install="grub2.install"
depends=('xz' 'freetype2' 'device-mapper' 'gettext' 'texinfo')
conflicts=('grub')
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
pkgdesc="GNU GRUB is a Multiboot boot loader. (Common files and utilities.)"
depends=('xz' 'freetype2' 'gettext' 'device-mapper' 'fuse')
conflicts=('grub')
install="grub2.install"
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
optdepends=('libisoburn: provides xorriso for generating grub rescue iso using grub-mkrescue'
'os-prober: to detect other operating systems when generating grub.cfg in BIOS systems'
'mtools: for grub-mkrescue FAT FS support')
options=('strip' 'purge' 'docs' 'zipman' '!emptydirs')
cd "${srcdir}/grub2_bios-${pkgver}"
make DESTDIR="${pkgdir}" install
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_bios-install"
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_efi_x86_64-install"
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_efi_i386-install"
# install it
cd "${srcdir}/build-grub2-bios"
make install \
bashcompletiondir=/usr/share/bash-completion/completions \
DESTDIR="${pkgdir}"
# install update-burg script
install -Dm755 "${srcdir}/update-grub" "${pkgdir}/sbin/update-grub"
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=pc|" \
"${pkgdir}/sbin/grub_bios-install"
# install Chakra files
install -D -m755 "${srcdir}/update-grub" "${pkgdir}/usr/sbin/update-grub"
install -D -m644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
install -D -m644 "${srcdir}/20_memtest86+" "${pkgdir}/etc/grub.d/20_memtest86+"
sed -i "s|^\(target_cpu\)=.*|\1=x86_64|; \
s|^\(platform\)=.*|\1=efi|" \
"${pkgdir}/sbin/grub_efi_x86_64-install"
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=efi|" \
"${pkgdir}/sbin/grub_efi_i386-install"
## install extra /etc/grub.d/ files
install -Dm755 "${srcdir}/20_memtest86+" "${pkgdir}/etc/grub.d/20_memtest86+"
## install /etc/default/grub (used by grub-mkconfig)
install -Dm644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
## create blank grub.cfg so it won't get removed on upgrade
mkdir -p "${pkgdir}/boot/grub"
touch "${pkgdir}/boot/grub/grub.cfg"
# remove platform specific files
# remove the architecture-dependant binaries from the package
rm -rf "${pkgdir}/usr/lib/grub/i386-pc"
# add resume-hook support
cd ${pkgdir}/sbin
patch -Np0 -i ${srcdir}/resume-hook.patch
}
package_grub2-bios() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Built for PC BIOS"
depends=("grub2-common=${pkgver}")
replaces=('grub2')
provides=('grub2')
cd "${srcdir}/grub2_bios-${pkgver}"
make DESTDIR="${pkgdir}" install
pkgdesc="GNU GRUB is a Multiboot boot loader. (BIOS support binaries.)"
depends=("grub2-common=${pkgver}")
options=('!strip' '!emptydirs')
## remove non platform-specific files
rm -rf "${pkgdir}"/{boot,bin,sbin,etc,usr/share}
rm "${pkgdir}/usr/lib/grub"/{grub-mkconfig_lib,update-grub_lib}
local _bindir="${pkgdir}/usr/lib/grub/i386-pc"
local _tmpdir="/tmp/_grub2-bios_bindir"
# install it
cd "${srcdir}/build-grub2-bios"
make install \
bashcompletiondir=/usr/share/bash-completion/completions \
DESTDIR="${pkgdir}"
# save our binaries from the destruction!
mv "${_bindir}" "${_tmpdir}" || return 1
# remove the rest (which is provided by grub2-common)
rm -rf "${pkgdir}"/* || return 1
# restore the binaries directory
install -d -m755 "${pkgdir}/usr/lib/grub"
mv "${_tmpdir}" "${_bindir}" || return 1
# remove gdb debugging related files
rm -f "${_bindir}"/*.module
rm -f "${_bindir}"/*.image
rm -f "${_bindir}"/{kernel.exec,gdb_grub,gmodule.pl}
}
package_grub2-efi-x32() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI version"
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
optdepends=('mtools')
cd "${srcdir}/grub2_efi-${pkgver}"
make DESTDIR="${pkgdir}" install
package_grub2-efi32() {
pkgdesc="GNU GRUB is a Multiboot boot loader. (EFI32 support binaries.)"
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
options=('!strip' '!emptydirs')
## remove non platform-specific files
rm -rf "${pkgdir}"/{boot,bin,sbin,etc,usr/share}
rm "${pkgdir}/usr/lib/grub"/{grub-mkconfig_lib,update-grub_lib}
local _bindir="${pkgdir}/usr/lib/grub/i386-efi"
local _tmpdir="/tmp/_grub2-efi32_bindir"
# install it
cd "${srcdir}/build-grub2-efi32"
make install \
bashcompletiondir=/usr/share/bash-completion/completions \
DESTDIR="${pkgdir}"
# save our binaries from the destruction!
mv "${_bindir}" "${_tmpdir}" || return 1
# remove the rest (which is provided by grub2-common)
rm -rf "${pkgdir}"/* || return 1
# restore the binaries directory
install -d -m755 "${pkgdir}/usr/lib/grub"
mv "${_tmpdir}" "${_bindir}" || return 1
# remove gdb debugging related files
rm -f "${_bindir}"/*.module
rm -f "${_bindir}"/*.image
rm -f "${_bindir}"/{kernel.exec,gdb_grub,gmodule.pl}
}
package_grub2-efi64() {
pkgdesc="GNU GRUB is a Multiboot boot loader (EFI64 support binaries.)"
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
options=('!strip' '!emptydirs')
local _bindir="${pkgdir}/usr/lib/grub/x86_64-efi"
local _tmpdir="/tmp/_grub2-efi64_bindir"
# install it
cd "${srcdir}/build-grub2-efi64"
make install \
bashcompletiondir=/usr/share/bash-completion/completions \
DESTDIR="${pkgdir}"
# save our binaries from the destruction!
mv "${_bindir}" "${_tmpdir}" || return 1
# remove the rest (which is provided by grub2-common)
rm -rf "${pkgdir}"/* || return 1
# restore the binaries directory
install -d -m755 "${pkgdir}/usr/lib/grub"
mv "${_tmpdir}" "${_bindir}" || return 1
# remove gdb debugging related files
rm -f "${_bindir}"/*.module
rm -f "${_bindir}"/*.image
rm -f "${_bindir}"/{kernel.exec,gdb_grub,gmodule.pl}
}
# vim:set ts=2 sw=2 et:

View File

@ -0,0 +1,107 @@
diff -Naur a/util/grub-mkconfig.in b/util/grub-mkconfig.in
--- a/util/grub-mkconfig.in 2012-07-15 04:23:47.048814588 +0200
+++ b/util/grub-mkconfig.in 2012-07-15 04:28:57.870930879 +0200
@@ -35,6 +35,7 @@
pkgdatadir="${datadir}/@PACKAGE@"
fi
grub_cfg=""
+resume_hook=1
grub_mkconfig_dir="${sysconfdir}"/grub.d
self=`basename $0`
@@ -57,6 +58,7 @@
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
+ print_option_help "-s, --skip-resume" "$(gettext "disable resume hook setup")"
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}
@@ -90,6 +92,9 @@
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
+ -s | --skip-resume)
+ resume_hook=0
+ ;;
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
@@ -216,7 +221,9 @@
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \
- GRUB_BADRAM
+ GRUB_BADRAM \
+ GRUB_COLOR_NORMAL \
+ GRUB_COLOR_HIGHLIGHT
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
@@ -253,6 +260,19 @@
esac
done
+if [ "${resume_hook}" == 1 ]; then
+ echo "Setup resume hook" >&2
+ SWAP="$(swapon -a | cat /proc/swaps | grep /dev | cut -d ' ' -f 1)"
+ if [ -z "${SWAP}" ]; then
+ echo "No swap partition found. Create one to enable hibernation..." >&2
+ else
+ echo "Adding swap partition ${SWAP}" >&2
+ SWAPUUID="$(blkid "${SWAP}" -s UUID -o value)"
+ sed -e "s~root=/dev/~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev/~g" \
+ -i "${grub_cfg}.new"
+ fi
+fi
+
if test "x${grub_cfg}" != "x" ; then
if ! ${grub_script_check} ${grub_cfg}.new; then
# TRANSLATORS: %s is replaced by filename
diff -Naur a/util/grub.d/00_header.in b/util/grub.d/00_header.in
--- a/util/grub.d/00_header.in 2012-07-15 04:23:47.048814588 +0200
+++ b/util/grub.d/00_header.in 2012-07-15 04:24:03.873603848 +0200
@@ -115,6 +115,14 @@
EOF
+if [ -n "$GRUB_COLOR_NORMAL" ] && [ -n "$GRUB_COLOR_HIGHLIGHT" ] ; then
+ cat << EOF
+set menu_color_normal=$GRUB_COLOR_NORMAL
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
+
+EOF
+fi
+
serial=0;
gfxterm=0;
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
diff -Naur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
--- a/util/grub.d/10_linux.in 2012-07-15 04:23:47.048814588 +0200
+++ b/util/grub.d/10_linux.in 2012-07-15 04:24:03.874603867 +0200
@@ -31,8 +31,8 @@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ OS="${GRUB_DISTRIBUTOR} Linux"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | tr -d ' ') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -195,10 +195,13 @@
"initrd-${version}" "initramfs-${version}.img" \
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
+ "initramfs-linux-${version}" "initramfs-linux-${version}.img" \
+ "initramfs-linux-${alt_version}" "initramfs-linux-${alt_version}.img" \
"initramfs-genkernel-${version}" \
"initramfs-genkernel-${alt_version}" \
"initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
- "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
+ "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" \
+ "${basename/vmlinuz/kernel}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break

View File

@ -1,115 +0,0 @@
diff -Naur a/util/grub-mkconfig.in b/util/grub-mkconfig.in
--- a/util/grub-mkconfig.in 2011-12-03 21:37:37.148786544 +0000
+++ b/util/grub-mkconfig.in 2011-12-03 21:37:48.445392013 +0000
@@ -252,6 +252,8 @@
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER \
+ GRUB_COLOR_NORMAL \
+ GRUB_COLOR_HIGHLIGHT \
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT \
GRUB_BADRAM
diff -Naur a/util/grub.d/00_header.in b/util/grub.d/00_header.in
--- a/util/grub.d/00_header.in 2011-12-03 21:37:37.148786544 +0000
+++ b/util/grub.d/00_header.in 2011-12-03 21:37:48.445392013 +0000
@@ -100,6 +100,14 @@
EOF
+if [ x$GRUB_COLOR_NORMAL != x ] && [ x$GRUB_COLOR_HIGHLIGHT != x ] ; then
+ cat << EOF
+set menu_color_normal=$GRUB_COLOR_NORMAL
+set menu_color_highlight=$GRUB_COLOR_HIGHLIGHT
+
+EOF
+fi
+
serial=0;
gfxterm=0;
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
diff -Naur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
--- a/util/grub.d/10_linux.in 2011-12-03 21:37:37.148786544 +0000
+++ b/util/grub.d/10_linux.in 2011-12-03 21:40:36.621147593 +0000
@@ -31,8 +31,8 @@ CLASS="--class gnu-linux --class gnu --c
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ OS="${GRUB_DISTRIBUTOR} Linux"
+ CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | tr -d ' ') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
@@ -49,7 +49,7 @@ if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue"
|| uses_abstraction "${GRUB_DEVICE}" lvm; 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
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
@@ -65,12 +65,19 @@ linux_entry ()
version="$2"
recovery="$3"
args="$4"
- if ${recovery} ; then
- title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
+ if [ "${version}" = "lts" ] ; then
+ _kernel=LTS
else
- title="$(gettext_quoted "%s, with Linux %s")"
+ _kernel=Standard
fi
- printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
+ if [ -n "$5" ] ; then
+ title="$(gettext_quoted "%s, with ${_kernel}-Kernel") $5"
+ elif ${recovery} ; then
+ title="$(gettext_quoted "%s, with ${_kernel}-Kernel (recovery mode)")"
+ else
+ title="$(gettext_quoted "%s, with ${_kernel}-Kernel")"
+ fi
+ printf "menuentry '${title}' ${CLASS} {\n" "${os}"
if ! ${recovery} ; then
save_default_entry | sed -e "s/^/\t/"
fi
@@ -132,7 +139,7 @@ EOF
case x`uname -m` in
xi?86 | xx86_64)
- list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* /boot/vmlinuz26-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done` ;;
*)
@@ -159,8 +166,11 @@ while [ "x$list" != "x" ] ; do
"initrd-${version}" "initramfs-${version}.img" \
"initrd.img-${alt_version}" "initrd-${alt_version}.img" \
"initrd-${alt_version}" "initramfs-${alt_version}.img" \
+ "initramfs-linux-${version}" "initramfs-linux-${version}.img" \
+ "initramfs-linux-${alt_version}" "initramfs-linux-${alt_version}.img" \
"initramfs-genkernel-${version}" \
- "initramfs-genkernel-${alt_version}"; do
+ "initramfs-genkernel-${alt_version}" \
+ "${basename/vmlinuz/kernel}.img"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
@@ -190,6 +200,15 @@ while [ "x$list" != "x" ] ; do
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ for i in "initramfs-${version}-fallback.img" \
+ "initramfs-linux-${alt_version}-fallback.img"; do
+ if test -e "${dirname}/${i}"; then
+ initrd="$i"
+ linux_entry "${OS}" "${version}" true \
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" Fallback
+ break
+ fi
+ done
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"

View File

@ -1,47 +0,0 @@
--- grub-mkconfig.orig 2012-01-21 23:08:55.000000000 +0100
+++ grub-mkconfig 2012-01-21 23:10:00.000000000 +0100
@@ -32,6 +32,7 @@ datarootdir=${prefix}/share
datadir=${datarootdir}
pkgdatadir=${datadir}/`echo grub | sed "${transform}"`
grub_cfg=""
+resume_hook=1
grub_mkconfig_dir=${sysconfdir}/grub.d
self=`basename $0`
@@ -52,6 +53,7 @@ Generate a grub config file
-o, --output=FILE output generated config to FILE [default=stdout]
-h, --help print this message and exit
-v, --version print the version information and exit
+ -s, --skip-resume disable resume hook setup
Report bugs to <bug-grub@gnu.org>.
EOF
@@ -86,6 +88,9 @@ do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
+ -s | --skip-resume)
+ resume_hook=0
+ ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@@ -295,6 +300,18 @@ for i in ${grub_mkconfig_dir}/* ; do
esac
done
+if [ "${resume_hook}" == 1 ]; then
+ echo "Setup resume hook" >&2
+ SWAP=`swapon -a | cat /proc/swaps | grep /dev | cut -d" " -f1`
+ if [ -z "${SWAP}" ]; then
+ echo "No swap partition found. Create one to enable hibernation..." >&2
+ else
+ echo "Adding swap partition $SWAP" >&2
+ SWAPUUID=`blkid $SWAP -s UUID -o value`
+ sed -i -e "s~root=/dev/~resume=/dev/disk/by-uuid/${SWAPUUID} root=/dev/~g" ${grub_cfg}.new
+ fi
+fi
+
if test "x${grub_cfg}" != "x" ; then
if ! ${grub_script_check} ${grub_cfg}.new; then
echo "Syntax errors are detected in generated GRUB config file." >&2