# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
-# Copyright (C) 2007-2011 IPFire-Team <info@ipfire.org>. #
+# Copyright (C) 2007-2014 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
-extract_files
-#
-KVER=xxxKVERxxx
-ROOT=`mount | grep " / " | cut -d" " -f1`
-ROOTUUID=`blkid -c /dev/null -sUUID $ROOT | cut -d'"' -f2`
-if [ ! -z $ROOTUUID ]; then
- ROOT="UUID=$ROOTUUID"
-fi
-MOUNT=`grep "kernel" /boot/grub/grub.conf | tail -n 1`
-# Nur den letzten Parameter verwenden
-echo $MOUNT > /dev/null
-MOUNT=$_
-if [ ! $MOUNT == "rw" ]; then
- MOUNT="ro"
-fi
-ENTRY=`grep "savedefault" /boot/grub/grub.conf | tail -n 1`
-# Nur den letzten Parameter verwenden
-echo $ENTRY > /dev/null
-let ENTRY=$_+1
+function find_partition() {
+ local mountpoint="${1}"
-#Check if the system use serial console...
-if [ "$(grep "^serial" /boot/grub/grub.conf)" == "" ]; then
- console=""
-else
- console=" console=ttyS0,38400n8"
-fi
+ local root
+ local dev mp fs flags rest
+ while read -r dev mp fs flags rest; do
+ # Skip unwanted entries
+ [ "${dev}" = "rootfs" ] && continue
+ if [ "${mp}" = "${mountpoint}" ] && [ -b "${dev}" ]; then
+ root="$(basename "${dev}")"
+ break
+ fi
+ done < /proc/mounts
+ echo ${root}
+ return 0
+}
+
+extract_files
#
-# backup grub.conf
-#
-cp /boot/grub/grub.conf /boot/grub/grub-backup-$KVER-pae.conf
+KVER=xxxKVERxxx
+ROOT=`find_partition /`
#
-# Add new Entry to grub.conf
+# Create new module depency
#
-echo "" >> /boot/grub/grub.conf
-echo "title IPFire (PAE-Kernel)" >> /boot/grub/grub.conf
-echo " kernel /vmlinuz-$KVER-ipfire-pae root=$ROOT panic=10$console $MOUNT" >> /boot/grub/grub.conf
-echo " initrd /ipfirerd-$KVER-pae.img" >> /boot/grub/grub.conf
-echo " savedefault $ENTRY" >> /boot/grub/grub.conf
+depmod -a $KVER-ipfire-pae
#
# Made initramdisk
#
-/sbin/dracut --force --verbose /boot/ipfirerd-$KVER-pae.img $KVER-ipfire-pae
-#
-# Create new module depency
-#
-depmod -a $KVER-ipfire-pae
+/usr/bin/dracut --force --xz /boot/initramfs-$KVER-ipfire-pae.img $KVER-ipfire-pae
+
+if [ -e /boot/grub/grub.cfg ]; then
+ #
+ # Update grub2 config
+ #
+ grub-mkconfig > /boot/grub/grub.cfg
+else
+ #
+ # xen pv with pygrub need grub.conf / menu.lst
+ #
+ echo "timeout 10" > /boot/grub/grub.conf
+ echo "default 0" >> /boot/grub/grub.conf
+ echo "title IPFire (pae-kernel)" >> /boot/grub/grub.conf
+ echo " kernel /vmlinuz-$KVER-ipfire-pae root=/dev/$ROOT rootdelay=10 panic=10 console=hvc0" \
+ >> /boot/grub/grub.conf
+ echo " initrd /initramfs-$KVER-ipfire-pae.img" >> /boot/grub/grub.conf
+ echo "# savedefault 0" >> /boot/grub/grub.conf
+ ln -s grub.conf $MNThdd/boot/grub/menu.lst
+fi
-# Default pae and request a reboot if pae is supported
+# request a reboot if pae is supported
if [ ! "$(grep "^flags.* pae " /proc/cpuinfo)" == "" ]; then
- grub-set-default $ENTRY
touch /var/run/need_reboot
fi
+sync && sync
\ No newline at end of file