grub: kernel hooks support.

This commit is contained in:
Juan RP 2011-07-10 00:03:36 +02:00
parent 9416d77890
commit b0c153b9db
2 changed files with 43 additions and 4 deletions

View File

@ -0,0 +1,31 @@
#!/bin/sh
#
# Kernel hook for GRUB 2.
#
# Arguments passed to this script: $1 pkgname, $2 version.
#
PKGNAME="$1"
VERSION="$2"
[ -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)
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 $?
fi
exit 0

View File

@ -1,7 +1,7 @@
# Template file for 'grub'
pkgname=grub
version=1.99
revision=2
revision=3
distfiles="http://ftp.gnu.org/gnu/grub/grub-$version.tar.xz"
build_style=gnu_configure
short_desc="GRand Unified Bootloader 2"
@ -24,7 +24,7 @@ Add_dependency run device-mapper
Add_dependency build xz
Add_dependency build flex
Add_dependency build bison
Add_dependency build texinfo
Add_dependency build zlib-devel
Add_dependency build libusb-compat-devel
Add_dependency build ncurses-devel
@ -36,6 +36,14 @@ Add_dependency full os-prober
post_install()
{
install -d ${DESTDIR}/etc/default
install -m644 ${FILESDIR}/grub.default ${DESTDIR}/etc/default/grub
# Required to compress info files.
vmkdir usr/share/info
touch -f ${DESTDIR}/usr/share/info/dir
vinstall ${FILESDIR}/grub.default 644 etc/default grub
# Kernel hooks.
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
etc/kernel.d/post-install 50-grub
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
etc/kernel.d/post-remove 50-grub
}