grub: simplify and remove unused stuff in postinst kernel hook.

This commit is contained in:
Juan RP 2012-12-14 12:57:48 +01:00
parent 1e4e559f04
commit abdacff0b0
2 changed files with 4 additions and 20 deletions

View file

@ -7,25 +7,9 @@
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 [ -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
if command -v grub-mkconfig >/dev/null 2>&1; then
if [ -d $ROOTDIR/boot/grub ]; then
grub-mkconfig -o $ROOTDIR/boot/grub/grub.cfg
exit $?
fi
fi

View file

@ -1,7 +1,7 @@
# Template file for 'grub'
pkgname=grub
version="2.00"
revision=7
revision=8
short_desc="GRand Unified Bootloader 2"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-3"