#!/bin/sh -e
#
-# Copyright (C) 2008 Intel
+# Copyright (C) 2008-2011 Intel
#
# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
#
mkdir /ssd
mkdir /rootmnt
+mkdir /bootmnt
mount $rootfs /ssd
mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
fi
fi
+if [ -f /ssd/etc/grub.d/40_custom ] ; then
+ echo "Preparing custom grub2 menu..."
+ sed -i "s@__ROOTFS__@$rootfs@g" /ssd/etc/grub.d/40_custom
+ sed -i "s/__VIDEO_MODE__/$3/g" /ssd/etc/grub.d/40_custom
+ sed -i "s/__VGA_MODE__/$4/g" /ssd/etc/grub.d/40_custom
+ mount $bootfs /bootmnt
+ cp /ssd/etc/grub.d/40_custom /bootmnt/40_custom
+ umount /bootmnt
+fi
+
umount /ssd
umount /rootmnt
echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
-echo "default 0" > /ssd/boot/grub/menu.lst
-echo "timeout 30" >> /ssd/boot/grub/menu.lst
-echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst
-echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst
-echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst
+if [ -f /ssd/40_custom ] ; then
+ mv /ssd/40_custom /ssd/boot/grub/grub.cfg
+ sed -i "/#/d" /ssd/boot/grub/grub.cfg
+ sed -i "/exec tail/d" /ssd/boot/grub/grub.cfg
+ chmod 0444 /ssd/boot/grub/grub.cfg
+else
+ echo "Preparing custom grub menu..."
+ echo "default 0" > /ssd/boot/grub/menu.lst
+ echo "timeout 30" >> /ssd/boot/grub/menu.lst
+ echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst
+ echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst
+ echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst
+fi
cp /media/$1/vmlinuz /ssd/boot/
-DESCRIPTION = "A live image init script"
+DESCRIPTION = "A live image init script for grub"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://init-install.sh"
-PR = "r4"
+PR = "r5"
RDEPENDS="grub parted e2fsprogs-mke2fs"
FILES_${PN} = " /install.sh "
-# Alternatives to grub need adding for other arch support
-# consistent with grub 0.97
-COMPATIBLE_HOST = "i.86.*-linux"
+COMPATIBLE_HOST = "(i.86|x86_64).*-linux"