Support --kernel-config=/proc/config.gz (bug #421027)
authorSebastian Pipping <sebastian@pipping.org>
Sun, 1 Jul 2012 12:03:51 +0000 (14:03 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 8 Jul 2012 17:17:10 +0000 (19:17 +0200)
ChangeLog
gen_configkernel.sh
gen_package.sh

index 7d5ad59834ad62df030b1c25e25d54e50cd10881..7b90ca8bbb0af9f59817742ce2287a8b1c6d50e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
 # Distributed under the GPL v2
 # $Id$
 
+  01 Jul 2012; Sebastian Pipping <sping@gentoo.org> gen_configkernel.sh,
+  gen_package.sh:
+  Support --kernel-config=/proc/config.gz (bug #421027)
+
   11 Jun 2012; Sebastian Pipping <sping@gentoo.org> genkernel:
   Bump version to 3.4.36
 
index 5d619faf9d9cbee27c295df131287104d6b37374..b0837dd05a6c10bba6ffed87518a5bbce580b6b2 100755 (executable)
@@ -56,7 +56,13 @@ config_kernel() {
        # or we might remove configurations someone is trying to test.
        if isTrue "${MRPROPER}" || [ ! -f "${KERNEL_DIR}/.config" ]
        then
-               cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
+               local message='Could not copy configuration file!'
+               if [[ "$(file --brief --mime-type "${KERNEL_CONFIG}")" == application/x-gzip ]]; then
+                       # Support --kernel-config=/proc/config.gz, mainly
+                       zcat "${KERNEL_CONFIG}" > "${KERNEL_DIR}/.config" || gen_die "${message}"
+               else
+                       cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die "${message}"
+               fi
        fi
 
        if isTrue "${OLDCONFIG}"
index e7c6142b2b6112536325e6771429964b6c39eb26..b83ccc1ffa27265a275e5d4287a76bfb783dec81 100755 (executable)
@@ -78,7 +78,13 @@ gen_kerncache()
        cd "${KERNEL_DIR}"
        cp "${tmp_kernel_binary}" "${TEMP}/kerncache/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy kernel for the kernel package!'
        cp "${KERNEL_DIR}/.config" "${TEMP}/kerncache/config-${ARCH}-${KV}"
-       cp "${KERNEL_CONFIG}" "${TEMP}/kerncache/config-${ARCH}-${KV}.orig"
+
+       if [[ "$(file --brief --mime-type "${KERNEL_CONFIG}")" == application/x-gzip ]]; then
+               # Support --kernel-config=/proc/config.gz, mainly
+               zcat "${KERNEL_CONFIG}" > "${TEMP}/kerncache/config-${ARCH}-${KV}.orig"
+       else
+               cp "${KERNEL_CONFIG}" "${TEMP}/kerncache/config-${ARCH}-${KV}.orig"
+       fi
        cp "${KERNEL_DIR}/System.map" "${TEMP}/kerncache/System.map-${ARCH}-${KV}"
        if isTrue "${GENZIMAGE}"
        then
@@ -180,7 +186,16 @@ gen_kerncache_is_valid()
                                else
                                        test1=$(grep -v "^#" ${TEMP}/config-${ARCH}-${KV} | md5sum | cut -d " " -f 1)
                                fi
-                               test2=$(grep -v "^#" ${KERNEL_CONFIG} | md5sum | cut -d " " -f 1)
+
+                               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
+                               test2=$("${CONFGREP}" -v "^#" ${KERNEL_CONFIG} | md5sum | cut -d " " -f 1)
+
+
                                if [ "${test1}" == "${test2}" ]
                                then
                                        echo