#!/bin/bash
#================
# FILE          : preinit
#----------------
# PROJECT       : OpenSuSE KIWI Image System
# COPYRIGHT     : (c) 2006 SUSE LINUX Products GmbH. All rights reserved
#               :
# AUTHOR        : Marcus Schaefer <ms@suse.de>
#               :
# BELONGS TO    : Operating System images
#               :
# DESCRIPTION   : This file is called after the image root
#               : has changed by the linuxrc script
#               :
# STATUS        : BETA
#----------------
#======================================
# Functions...
#--------------------------------------
. /include

#======================================
# 1) create initrd on diskful
#--------------------------------------
if test -L /boot/boot;then
	mount -t proc proc /proc
	mount -t sysfs sysfs /sys
	mkinitrd 
	umount /sys
	umount /proc
else
	Echo "Image doesn't provide kernel system map"
	Echo "Can't create initrd"
fi

#======================================
# 2) Install boot loader on diskful
#--------------------------------------
if test -f "/usr/sbin/grub";then
	Echo "Installing boot loader..."
	/usr/sbin/grub --batch --no-floppy < /etc/grub.conf >/dev/null 2>&1
else
	Echo "Image doesn't provide grub support"
	Echo "Can't install boot loader"
fi
