@ -23,7 +23,7 @@ set_grub_bootloader() {
[ " x $GRUB_BOOTFS " = = 'x' ] && GRUB_BOOTFS = $GRUB_ROOTFS
# Translate block letters into grub numbers
local GRUB_ROOT_DISK = $( echo $GRUB_ROOTFS | sed -e 's/\/dev\/[hs ]d\([[:alpha:]]\)[[:digit:]]\+/\1/')
local GRUB_ROOT_DISK = $( echo $GRUB_ROOTFS | sed -e 's/\/dev\/[hs m ]d\([[:alpha:]]\)[[:digit:]]\+/\1/')
case $GRUB_ROOT_DISK in
a )
GRUB_ROOT_DISK = '0' ; ;
@ -38,14 +38,20 @@ set_grub_bootloader() {
esac
# Translate partition numbers into grub numbers
local GRUB_ROOT_PARTITION = $( echo $GRUB_BOOTFS | sed -e 's/\/dev\/[hs]d[[:alpha:]]\([[:digit:]]\+\)/\1/' )
local GRUB_ROOT_PARTITION = $(( $GRUB_ROOT_PARTITION - 1 ))
local GRUB_ROOT_PARTITION = $( echo $GRUB_BOOTFS | sed -e 's/\/dev\/[hsm]d[[:alpha:]]\([[:digit:]]\+\)/\1/' )
# Create grub configuration directory and file if it doesn't exist.
[ ! -e ` basename $GRUB_CONF ` ] && mkdir -p ` basename $GRUB_CONF `
if [ ! -e $GRUB_CONF ]
then
# Check that $GRUB_ROOT_PARTITION is a single character
local GRUB_ROOT_PARTITION_TEST = $( printf $GRUB_ROOT_PARTITION | wc -c)
if [ " ${ GRUB_ROOT_PARTITION_TEST } " -ne '1' ]
# GRUB_ROOT_PARTITION is not a number; we can't work this out so... error
print_error 1 'Error! /boot/grub/grub.conf does not exist and the correct settings can' t be automatically detected.'
print_error 1 'Please manually create your /boot/grub/grub.conf file.'
else
# grub.conf doesn't exist - create it with standard defaults
touch $GRUB_CONF
echo 'default 0' >> $GRUB_CONF
@ -64,6 +70,7 @@ set_grub_bootloader() {
echo -e " \tinitrd /initrd- $KV " >> $GRUB_CONF
fi
echo "" >> $GRUB_CONF
fi
else
# grub.conf already exists; so...
# ... Clone the first boot definition and change the version.