Commit patches #91453, #91481 from bug #139866.
authorTim Yamin <plasmaroo@gentoo.org>
Tue, 18 Jul 2006 22:06:46 +0000 (22:06 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Tue, 18 Jul 2006 22:06:46 +0000 (22:06 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@420 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_bootloader.sh
gen_funcs.sh
gen_package.sh
genkernel

index 51ada96e9abc25d74f0f64c7f577235b2ae4c173..a1ec20ebe15b7e77cff8ac499294cd029521c855 100644 (file)
@@ -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...
index 7143bef3a6ec84c873cf67b9fa7d2a9be7b8c02b..d419e0d386d29cc9ba639a65a5e3990a52061c8c 100755 (executable)
@@ -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()
index 8f172f19eb6164683c0ed6596720f90a76acd233..d696b722c7433767c36304d94c346b6f1f46c818 100644 (file)
@@ -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()
index 9bca48bf0527b7918ff5407429397a79a6a1ad52..0bb16fabeed16e792e81a26f4d80df597bcba00d 100755 (executable)
--- 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