From 1e4e559f04b7843f486b7f198e4d104878f9821a Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 14 Dec 2012 12:29:04 +0100 Subject: [PATCH] grub: some fixes for the kernel postinst hook. --- srcpkgs/grub/files/kernel.d/grub.post | 28 ++++++++++++++------------- srcpkgs/grub/template | 13 ++++++++----- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/srcpkgs/grub/files/kernel.d/grub.post b/srcpkgs/grub/files/kernel.d/grub.post index 8fcff2ba4d..6d46fb4815 100644 --- a/srcpkgs/grub/files/kernel.d/grub.post +++ b/srcpkgs/grub/files/kernel.d/grub.post @@ -7,25 +7,27 @@ PKGNAME="$1" VERSION="$2" -[ -r /boot/grub/grub.cfg ] \ +[ -r boot/grub/grub.cfg ] \ && groot=$(awk '/^set root=/{print substr($2, 8, 3); exit}' \ - /boot/grub/grub.cfg) -[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \ - && dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map) + boot/grub/grub.cfg) +[ -e boot/grub/device.map ] && [ -n "${groot}" ] \ + && dev=$(awk "/${groot}/{ print \$NF}" boot/grub/device.map) -if [ -n "${dev}" -a -r "${dev}" ]; then +if [ -n "$dev" -a -r "$dev" ]; then dd if="${dev}" bs=512 skip=0 count=1 2>/dev/null|grep -q GRUB [ $? -eq 0 ] && grub_installed=1 fi -if [ -n "${dev}" -a -z "$grub_installed" ]; then - echo "WARNING: GRUB2 has not been installed into ${dev}." - echo "WARNING: please run 'grub-install ${dev}'." -fi - -if command -v grub-mkconfig >/dev/null 2>&1; then - grub-mkconfig -o /boot/grub/grub.cfg - exit $? +if [ -z "$dev" -a -z "$grub_installed" ]; then + exit 0 +elif [ -n "$dev" -a -z "$grub_installed" ]; then + echo "WARNING: GRUB2 has not been installed into $dev." + echo "WARNING: please run 'grub-install $dev'." +else + if command -v grub-mkconfig >/dev/null 2>&1; then + grub-mkconfig -o boot/grub/grub.cfg + exit $? + fi fi exit 0 diff --git a/srcpkgs/grub/template b/srcpkgs/grub/template index a5e59d22e4..c23642f1a6 100644 --- a/srcpkgs/grub/template +++ b/srcpkgs/grub/template @@ -1,11 +1,7 @@ # Template file for 'grub' pkgname=grub version="2.00" -revision=6 -makedepends="flex libusb-compat-devel ncurses-devel freetype-devel -liblzma-devel device-mapper-devel font-unifont-bdf fuse-devel" -fulldepends="os-prober" -conf_files="/etc/default/grub /etc/grub.d/40_custom" +revision=7 short_desc="GRand Unified Bootloader 2" maintainer="Juan RP " license="GPL-3" @@ -17,6 +13,13 @@ long_desc=" GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more robust, more powerful, and more portable." +makedepends="flex libusb-compat-devel ncurses-devel freetype-devel + liblzma-devel device-mapper-devel font-unifont-bdf fuse-devel" + +depends="os-prober" + +conf_files="/etc/default/grub /etc/grub.d/40_custom" + if [ "$XBPS_MACHINE" = "x86_64" ]; then subpackages="grub-x86_64-efi" fi