Move the sourcing of software.sh to genkernel
[genkernel.git] / gen_configkernel.sh
index faf18746f865c68628c35c92aa5877997a97c335..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}"
@@ -73,7 +79,7 @@ config_kernel() {
        else
                print_info 1 "kernel: --clean is disabled; not running 'make clean'."
        fi
-       
+
        if isTrue ${MENUCONFIG}
        then
                print_info 1 'kernel: >> Invoking menuconfig...'