From: Sebastian Pipping Date: Sun, 8 Jul 2012 21:39:10 +0000 (+0200) Subject: Use proper ${KERNEL_CONFIG} rather than ${KERNEL_DIR}/.config as input X-Git-Tag: v3.4.37~1^2~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=88892f5df2453f959539c444a4d0ac161ec70d8f;p=genkernel.git Use proper ${KERNEL_CONFIG} rather than ${KERNEL_DIR}/.config as input --- diff --git a/gen_initramfs.sh b/gen_initramfs.sh index f0b63d9..9ccd5f3 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -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 diff --git a/genkernel b/genkernel index 61dd493..103c434 100755 --- 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=" to boot from a ZFS dataset' [ "${ISCSI}" = '1' ] && print_warning 1 'add at least "iscsi_initiatorname= iscsi_target= and iscsi_address=" 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}