#!/bin/bash # $Id$ source /etc/installer.conf source ${INSTALLER_DIR}/include/hwdetection.sh : ${INSTALL_ROOT="/mnt/magellan"} create_device_map() { local chroot [[ ! -z ${INSTALL_ROOT} ]] && chroot=chrooted # create device.map ${chroot} grub --batch --no-floppy --no-config-file --device-map=/boot/grub/device.map /dev/null | awk '{if ($6 < 64) printf("%c%d0", $1, $5); else printf("%c%d1", $1, $5)}') if [[ ${major_minor} = ${bios_major_minor} ]] then # we found it root_drive=$(grep ${bios_drive} ${INSTALL_ROOT}/boot/grub/device.map | awk '{print $1}') root_part=$(ls -Ll ${device} | awk '{print $6}') root_part=$(( ${root_part} % 16 - 1 )) break fi done drive=$(echo ${root_drive} | sed "s:)$:,${root_part}):") echo ${drive} } add_grub_conf() { echo "$@" >> ${INSTALL_ROOT}/boot/grub/grub.conf } create_grub_conf() { local splashimage local grub_disk if [[ -z ${PARTITION_DISK_BOOT} ]] then grub_disk="${PARTITION_DISK_ROOT}" else grub_disk="${PARTITION_DISK_BOOT}" fi # create an empty one :> ${INSTALL_ROOT}/boot/grub/grub.conf add_grub_conf "default 0" add_grub_conf "timeout 10" add_grub_conf "" # our splashimage splashimage="magellan.xpm.gz" # forcefully use gfxsplash [[ ! -f ${INSTALL_ROOT}/boot/${splashimage} ]] && cp ${INSTALLER_DIR}/data/magellan-black2.xpm.gz ${INSTALL_ROOT}/boot/${splashimage} if [[ -f ${INSTALL_ROOT}/boot/${splashimage} ]] then add_grub_conf "# splash image" add_grub_conf "splashimage $(convert_device ${grub_disk})/boot/${splashimage}" add_grub_conf "foreground FFFFFF" add_grub_conf "background 253861" add_grub_conf "" else add_grub_conf "# some pretty colors" add_grub_conf "color cyan/blue white/blue" add_grub_conf "" fi add_grub_conf "title Magellan-Linux $(< ${INSTALL_ROOT}/etc/mageversion) ($(readlink ${INSTALL_ROOT}/boot/vmlinuz | sed s:kernel-::))" add_grub_conf "root $(convert_device ${grub_disk})" add_grub_conf "kernel /boot/$(readlink ${INSTALL_ROOT}/boot/vmlinuz) root=UUID=$(get_uuid ${PARTITION_DISK_ROOT})" add_grub_conf "initrd /boot/$(readlink ${INSTALL_ROOT}/boot/initrd)" # add an empty line as spacer between other boot entries add_grub_conf "" } install_bootloader() { create_device_map >> ${INSTALLER_LOG} 2>&1 echo 25 create_grub_conf >> ${INSTALLER_LOG} 2>&1 echo 50 install_grub >> ${INSTALLER_LOG} 2>&1 echo 100 }