Use proper ${KERNEL_CONFIG} rather than ${KERNEL_DIR}/.config as input
authorSebastian Pipping <sebastian@pipping.org>
Sun, 8 Jul 2012 21:39:10 +0000 (23:39 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 8 Jul 2012 22:01:42 +0000 (00:01 +0200)
gen_initramfs.sh
genkernel

index f0b63d9f169f43e71b3aaf7f4c9eab93534b1d14..9ccd5f3092b4f1f1de26d2792a6b31d760b5e8e7 100755 (executable)
@@ -754,6 +754,13 @@ create_initramfs() {
        else
                if isTrue "${COMPRESS_INITRD}"
                then
+                       if [[ "$(file --brief --mime-type "${KERNEL_CONFIG}")" == application/x-gzip ]]; then
+                               # Support --kernel-config=/proc/config.gz, mainly
+                               local CONFGREP=zgrep
+                       else
+                               local CONFGREP=grep
+                       fi
+
                        cmd_xz=$(type -p xz)
                        cmd_lzma=$(type -p lzma)
                        cmd_bzip2=$(type -p bzip2)
@@ -778,7 +785,7 @@ create_initramfs() {
                                                set -- ${tuple}
                                                kernel_option=$1
                                                cmd_variable_name=$2
-                                               if grep -sq "^${kernel_option}=y" ${KERNEL_DIR}/.config && test -n "${!cmd_variable_name}" ; then
+                                               if ${CONFGREP} -q "^${kernel_option}=y" "${KERNEL_CONFIG}" && test -n "${!cmd_variable_name}" ; then
                                                        compression=$3
                                                        [[ ${COMPRESS_INITRD_TYPE} == best ]] && break
                                                fi
index 61dd4938ac400da7fe7cdd547ed266b9147dd05d..103c43453186bfd6e0b34032077ee110689587f9 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -352,10 +352,20 @@ then
        [ "${ZFS}" = '1' ] && print_warning 1 'add "dozfs" for ZFS volume management support'
        [ "${ZFS}" = '1' ] && print_warning 1 'add either "real_root=ZFS" (bootfs autodetection) or "real_root=ZFS=<dataset>" to boot from a ZFS dataset'
        [ "${ISCSI}" = '1' ] && print_warning 1 'add at least "iscsi_initiatorname=<initiator name> iscsi_target=<target name> and iscsi_address=<target ip>" for iscsi support'
-       if [ `grep 'CONFIG_EXT[0-9]_FS=' "${KERNEL_DIR}"/.config | wc -l` -ge 2 ]; then
+
+       if [[ "$(file --brief --mime-type "${KERNEL_CONFIG}")" == application/x-gzip ]]; then
+               # Support --kernel-config=/proc/config.gz, mainly
+               CONFGREP=zgrep
+       else
+               CONFGREP=grep
+       fi
+
+       if [ `${CONFGREP} 'CONFIG_EXT[0-9]_FS=' "${KERNEL_CONFIG}" | wc -l` -ge 2 ]; then
                print_warning 1 'With support for several ext* filesystems around it may be needed to'
                print_warning 1 'add "rootfstype=ext3" or "rootfstype=ext4"'
        fi
+
+       unset CONFGREP
 fi
 
 [ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}