From: Tim Yamin Date: Tue, 18 Jul 2006 22:06:46 +0000 (+0000) Subject: Commit patches #91453, #91481 from bug #139866. X-Git-Tag: v3.4.10.902~332 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c3ad7159bce73a03de7b2b4e44f30d1c3dbc337;p=genkernel.git Commit patches #91453, #91481 from bug #139866. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@420 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 51ada96..a1ec20e 100644 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -10,7 +10,7 @@ set_bootloader() { } set_grub_bootloader() { - local GRUB_CONF='${BOOTDIR}/grub/grub.conf' + local GRUB_CONF="${BOOTDIR}/grub/grub.conf" print_info 1 '' print_info 1 "Adding kernel to $GRUB_CONF..." @@ -19,8 +19,8 @@ set_grub_bootloader() { GRUB_BOOTFS=${BOOTFS} else # Extract block device information from /etc/fstab - GRUB_ROOTFS=$(awk '/^[^#].+[[:space:]]\/[[:space:]]/ { print $1 }' /etc/fstab) - GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ { print $1 }' /etc/fstab) + GRUB_ROOTFS=$(awk 'BEGIN{RS="((#[^\n]*)?\n)"}( $2 == "/" ) { print $1; exit }' /etc/fstab) + GRUB_BOOTFS=$(awk 'BEGIN{RS="((#[^\n]*)?\n)"}( $2 == "'${BOOTDIR}'") { print $1; exit }' /etc/fstab) # If ${BOOTDIR} is not defined in /etc/fstab, it must be the same as / [ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS @@ -70,8 +70,8 @@ EOF fi echo >> $GRUB_CONF else - print_error 1 'Error! ${BOOTDIR}/grub/grub.conf does not exist and the correct settings can not be automatically detected.' - print_error 1 'Please manually create your ${BOOTDIR}/grub/grub.conf file.' + print_error 1 "Error! ${BOOTDIR}/grub/grub.conf does not exist and the correct settings can not be automatically detected." + print_error 1 "Please manually create your ${BOOTDIR}/grub/grub.conf file." fi else # grub.conf already exists; so... diff --git a/gen_funcs.sh b/gen_funcs.sh index 7143bef..d419e0d 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -252,14 +252,7 @@ has_loop() { isBootRO() { - for mo in `grep ' ${BOOTDIR} ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'` - do - if [ "x${mo}x" == "xrox" ] - then - return 0 - fi - done - return 1 + return $(awk '( $2 == "'${BOOTDIR}'" && $4 ~ /(^|,)ro(,|$)/){ I=1; exit }END{print !I }' /proc/mounts); } setup_cache_dir() diff --git a/gen_package.sh b/gen_package.sh index 8f172f1..d696b72 100644 --- a/gen_package.sh +++ b/gen_package.sh @@ -89,12 +89,12 @@ gen_kerncache() gen_kerncache_extract_kernel() { /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj - cp "${TEMP}/kernel-${ARCH}-${KV}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!' + cp "${TEMP}/kernel-${ARCH}-${KV}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die "Could not copy the kernel binary to ${BOOTDIR}!" if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ] then - cp "${TEMP}/kernelz-${ARCH}-${KV}" "${BOOTDIR}/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!' + cp "${TEMP}/kernelz-${ARCH}-${KV}" "${BOOTDIR}/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die "Could not copy the kernel binary to ${BOOTDIR}!" fi - cp "${TEMP}/System.map-${ARCH}-${KV}" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to ${BOOTDIR}!' + cp "${TEMP}/System.map-${ARCH}-${KV}" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die "Could not copy System.map to ${BOOTDIR}!" } gen_kerncache_extract_modules() diff --git a/genkernel b/genkernel index 9bca48b..0bb16fa 100755 --- a/genkernel +++ b/genkernel @@ -133,9 +133,9 @@ then else [[ -d ${BOOTDIR} ]] || gen_die "${BOOTDIR} is not a directory" - if ! egrep -q ' ${BOOTDIR} ' /proc/mounts + if ! egrep -q "[[:space:]]${BOOTDIR}[[:space:]]" /proc/mounts then - if egrep -q '^[^#].+[ \t]${BOOTDIR}[ \t]' /etc/fstab + if egrep -q "^[^#].+[[:space:]]${BOOTDIR}[[:space:]]" /etc/fstab then if isTrue ${MOUNTBOOT} then @@ -144,11 +144,11 @@ else print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount ${BOOTDIR}!" echo else - print_info 1 'mount: ${BOOTDIR} mounted successfully!' + print_info 1 "mount: ${BOOTDIR} mounted successfully!" fi else print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!" - print_warning 1 ' Run ``mount ${BOOTDIR}`` to mount it!' + print_warning 1 " Run ``mount ${BOOTDIR}`` to mount it!" echo fi fi