From: Tim Yamin Date: Sun, 10 Jul 2005 00:27:47 +0000 (+0000) Subject: Fix #93178, #98436, #98501 X-Git-Tag: v3.4.10.902~510 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6c74fd4d9790bff7b9243892710581f7a1d0a829;p=genkernel.git Fix #93178, #98436, #98501 git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@242 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/gen_bootloader.sh b/gen_bootloader.sh index de8ada6..74b6621 100644 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -22,34 +22,40 @@ set_grub_bootloader() { # If /boot is not defined in /etc/fstab, it must be the same as / [ "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\/[hsm]d\([[:alpha:]]\)[[:digit:]]\+/\1/') - case $GRUB_ROOT_DISK in - a ) - GRUB_ROOT_DISK='0' ;; - b ) - GRUB_ROOT_DISK='1' ;; - c ) - GRUB_ROOT_DISK='2' ;; - d ) - GRUB_ROOT_DISK='3' ;; - e ) - GRUB_ROOT_DISK='4' ;; - esac + # Read GRUB device map + echo ${tmp} + if [ ! -d ${tmp} ] + then + mkdir ${tmp} + fi + + grub --batch --device-map=${tmp}/grub.map </dev/null +quit +EOF - # Translate partition numbers into grub numbers - local GRUB_ROOT_PARTITION=$(echo $GRUB_BOOTFS | sed -e 's/\/dev\/[hsm]d[[:alpha:]]\([[:digit:]]\+\)/\1/') + # Get the GRUB mapping for our device + local GRUB_BOOT_DISK1=$(echo $GRUB_BOOTFS | sed -e 's#\(/dev/.\+\)[[:digit:]]\+#\1#') + echo ${GRUB_BOOT_DISK1} + local GRUB_BOOT_DISK=$(awk '{if ($2 == "'$GRUB_BOOT_DISK1'") {gsub(/(\(|\))/, "", $1); print $1;}}' ${tmp}/grub.map) + local GRUB_BOOT_PARTITION=$(echo $GRUB_BOOTFS | sed -e 's#/dev/.\+\([[:digit:]]\+\)#\1#') + if [ ! -d ${tmp} ] + then + rm -r ${tmp} + fi + echo ${GRUB_ROOTFS} + + echo ${GRUB_BOOTFS} + echo ${GRUB_BOOT_DISK} + echo ${GRUB_BOOT_PARTITION} + # 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' ] + if [ "${GRUB_BOOT_DISK}" = '' -o "${GRUB_BOOT_PARTITION}" = '' ] then - # 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 @@ -57,12 +63,12 @@ set_grub_bootloader() { touch $GRUB_CONF echo 'default 0' >> $GRUB_CONF echo 'timeout 5' >> $GRUB_CONF - echo "" >> $GRUB_CONF + echo >> $GRUB_CONF # Add grub configuration to grub.conf echo "# Genkernel generated entry, see GRUB documentation for details" >> $GRUB_CONF echo "title=Gentoo Linux ($KV)" >> $GRUB_CONF - echo -e "\troot (hd$GRUB_ROOT_DISK,$GRUB_ROOT_PARTITION)" >> $GRUB_CONF + echo -e "\troot ($GRUB_BOOT_DISK,$GRUB_BOOT_PARTITION)" >> $GRUB_CONF if [ "${BUILD_INITRD}" -eq '0' ] then echo -e "\tkernel /kernel-$KV root=$GRUB_ROOTFS" >> $GRUB_CONF @@ -70,7 +76,7 @@ set_grub_bootloader() { echo -e "\tkernel /kernel-$KV root=/dev/ram0 init=/linuxrc real_root=$GRUB_ROOTFS" >> $GRUB_CONF echo -e "\tinitrd /initrd-$KV" >> $GRUB_CONF fi - echo "" >> $GRUB_CONF + echo >> $GRUB_CONF fi else # grub.conf already exists; so... diff --git a/generic/linuxrc b/generic/linuxrc index a47c21c..c6ab10e 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -204,8 +204,8 @@ then for i in dev mnt mnt/cdrom mnt/livecd tmp tmp/.initrd mnt/gentoo sys do - mkdir ${NEW_ROOT}/$i - chown 755 ${NEW_ROOT}/$i + mkdir ${NEW_ROOT}/$i + chmod 755 ${NEW_ROOT}/$i done cp /dev/null ${NEW_ROOT}/dev cp /dev/console ${NEW_ROOT}/dev diff --git a/genkernel b/genkernel index 2312d46..62a8914 100755 --- a/genkernel +++ b/genkernel @@ -2,7 +2,7 @@ # Genkernel v3 PATH="/bin:/usr/bin:/sbin:/usr/sbin" -GK_V='3.2.0' +GK_V='3.2.1' TEMP='/var/tmp/genkernel' TODEBUGCACHE=1 # Until an error occurs or DEBUGFILE is fully qualified.