From ab041c147a0161d1bf52bd5a6498b132a77ae60a Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 1 Dec 2012 01:48:28 +0400 Subject: [PATCH] Grub-scripts updated. --- sbin/e4rat_switch.sh | 12 +++++++++--- sbin/kernel-rebuild.sh | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sbin/e4rat_switch.sh b/sbin/e4rat_switch.sh index 361702d..e894210 100755 --- a/sbin/e4rat_switch.sh +++ b/sbin/e4rat_switch.sh @@ -1,6 +1,12 @@ #!/bin/bash -if [[ `which e4rat-realloc 2>/dev/null` && `grep 'init=/sbin/e4rat-' /boot/grub/grub.conf` ]]; then +GRUB_CFG_FLIST="" +[ -f /boot/grub/grub.conf ] && GRUB_CFG_FLIST="$GRUB_CFG_FLIST /boot/grub/grub.conf" +[ -f /boot/grub2/grub.cfg ] && GRUB_CFG_FLIST="$GRUB_CFG_FLIST /boot/grub2/grub.cfg" + +[ "" == "$GRUB_CFG_FLIST" ] && echo 'No Grub config files found! ;-(' && exit -1 + +if [[ `which e4rat-realloc 2>/dev/null` && `grep 'init=/sbin/e4rat-' $GRUB_CFG_FLIST` ]]; then echo "e4rat package and e4rat init record in grub.conf found ;-)" else echo "Either e4rat package or e4rat record in grub.conf not found, exiting..." @@ -13,7 +19,7 @@ case $1 in echo "remounting /boot -> rw" mount -o remount,rw /boot && \ sed -i "s~init=/sbin/e4rat-[a-z]*~init=/sbin/e4rat-collect~g" \ - /boot/grub/grub.conf && \ + $GRUB_CFG_FLIST && \ echo "remounting /boot -> ro" && \ mount -o remount,ro /boot && \ echo -e "#/bin/bash\n\n(/usr/sbin/e4rat_finalize.sh && rm -f /etc/local.d/e4rat_finalize.start)&\n" \ @@ -26,7 +32,7 @@ case $1 in echo "remounting /boot -> rw" mount -o remount,rw /boot && \ sed -i "s~init=/sbin/e4rat-[a-z]*~init=/sbin/e4rat-preload~g" \ - /boot/grub/grub.conf && \ + $GRUB_CFG_FLIST && \ echo "remounting /boot -> ro" && \ mount -o remount,ro /boot [ 0 -ne $? ] && echo "e4rat_switch.sh $1 failed" && exit -1 diff --git a/sbin/kernel-rebuild.sh b/sbin/kernel-rebuild.sh index a5101f0..997e3d7 100755 --- a/sbin/kernel-rebuild.sh +++ b/sbin/kernel-rebuild.sh @@ -72,10 +72,13 @@ REVISION=`cat /usr/src/linux/include/config/kernel.release` which dracut &>/dev/null && $NICE_CMD dracut --hostonly --force /boot/initramfs-$REVISION.img $REVISION +[ -f /boot/grub/grub.conf ] && \ sed -i "s~\/boot\/vmlinuz-[0-9][^ ]*~\/boot\/vmlinuz-$REVISION~g; s~\/boot\/initramfs-[0-9][^ ]*~\/boot\/initramfs-$REVISION.img~g" \ /boot/grub/grub.conf +[ -f /boot/grub2/grub.cfg ] && grub2-mkconfig -o /boot/grub2/grub.cfg + echo "--------- Rebuilding kernel modules ---------" emerge -1qv @module-rebuild [ 0 -ne $? ] && echo "Upgrading kernel modules failed ;-(" && exit -1