Fix selection of Grub version.

This commit is contained in:
Kolan Sh 2014-08-07 15:45:42 +04:00
parent 4176622975
commit 20ca5135f1
2 changed files with 23 additions and 15 deletions

View File

@ -31,15 +31,18 @@ for f in System.map config vmlinuz kernel-genkernel initramfs; do
done done
mount -o remount,ro -force /boot mount -o remount,ro -force /boot
# updating grub menu # Updating Grub config
echo "Updating Grub menu" echo "Updating Grub menu"
[ -f /boot/grub/grub.conf ] && \ if [ `which grub2-mkconfig 2>/dev/null` ]; then
sed -i "s~\/boot\/vmlinuz-[0-9][^ ]*~\/boot\/vmlinuz-$REVISION~g; [ -f /boot/grub/grub.cfg ] && grub2-mkconfig -o /boot/grub/grub.cfg
s~\/boot\/kernel-genkernel-`uname -m`-[0-9][^ ]*~\/boot\/kernel-genkernel-`uname -m`-$REVISION~g; [ -f /boot/grub2/grub.cfg ] && grub2-mkconfig -o /boot/grub2/grub.cfg
s~\/boot\/initramfs-[0-9][^ ]*~\/boot\/initramfs-$REVISION.img~g" \ else
/boot/grub/grub.conf [ -f /boot/grub/grub.conf ] && \
sed -i "s~\/boot\/vmlinuz-[0-9][^ ]*~\/boot\/vmlinuz-$REVISION~g;
[ -f /boot/grub2/grub.cfg ] && grub2-mkconfig -o /boot/grub2/grub.cfg s~\/boot\/kernel-genkernel-`uname -m`-[0-9][^ ]*~\/boot\/kernel-genkernel-`uname -m`-$REVISION~g;
s~\/boot\/initramfs-[0-9][^ ]*~\/boot\/initramfs-$REVISION.img~g" \
/boot/grub/grub.conf
fi
# rm old sources # rm old sources
cd /usr/src cd /usr/src

View File

@ -99,13 +99,18 @@ else
which dracut &>/dev/null && $NICE_CMD dracut --hostonly --force /boot/initramfs-$REVISION.img $REVISION which dracut &>/dev/null && $NICE_CMD dracut --hostonly --force /boot/initramfs-$REVISION.img $REVISION
fi fi
[ -f /boot/grub/grub.conf ] && \ # Updating Grub config
sed -i "s~\/boot\/vmlinuz-[0-9][^ ]*~\/boot\/vmlinuz-$REVISION~g; echo "Updating Grub menu"
s~\/boot\/kernel-genkernel-`uname -m`-[0-9][^ ]*~\/boot\/kernel-genkernel-`uname -m`-$REVISION~g; if [ `which grub2-mkconfig 2>/dev/null` ]; then
s~\/boot\/initramfs-[0-9][^ ]*~\/boot\/initramfs-$REVISION.img~g" \ [ -f /boot/grub/grub.cfg ] && grub2-mkconfig -o /boot/grub/grub.cfg
/boot/grub/grub.conf [ -f /boot/grub2/grub.cfg ] && grub2-mkconfig -o /boot/grub2/grub.cfg
else
[ -f /boot/grub2/grub.cfg ] && grub2-mkconfig -o /boot/grub2/grub.cfg [ -f /boot/grub/grub.conf ] && \
sed -i "s~\/boot\/vmlinuz-[0-9][^ ]*~\/boot\/vmlinuz-$REVISION~g;
s~\/boot\/kernel-genkernel-`uname -m`-[0-9][^ ]*~\/boot\/kernel-genkernel-`uname -m`-$REVISION~g;
s~\/boot\/initramfs-[0-9][^ ]*~\/boot\/initramfs-$REVISION.img~g" \
/boot/grub/grub.conf
fi
echo "--------- Rebuilding kernel modules ---------" echo "--------- Rebuilding kernel modules ---------"
emerge -1v @module-rebuild emerge -1v @module-rebuild