Handle missing kernel .config better (bug #271528)
authorSebastian Pipping <sebastian@pipping.org>
Thu, 13 Jan 2011 13:29:23 +0000 (14:29 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Thu, 13 Jan 2011 13:31:32 +0000 (14:31 +0100)
gen_configkernel.sh

index 8c00f8d5e158ee319351226cb69dc25d851adedc..ee76ec1c18886cd441b9194fd81e046a58fc537d 100755 (executable)
@@ -29,7 +29,19 @@ config_kernel() {
        determine_config_file
        cd "${KERNEL_DIR}" || gen_die 'Could not switch to the kernel directory!'
 
-       isTrue "${CLEAN}" && cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config.bak" > /dev/null 2>&1
+       # Backup and replace kernel .config
+       if isTrue "${CLEAN}" || [ ! -f "${KERNEL_DIR}/.config" ]
+       then
+               print_info 1 "config: Using config from ${KERNEL_CONFIG}"
+               if [ -f "${KERNEL_DIR}/.config" ]
+               then
+                       cp "${KERNEL_DIR}/.config" "${KERNEL_DIR}/.config.bak" \
+                                       || gen_die "Could not backup kernel config (${KERNEL_DIR}/.config)"
+                       print_info 1 '        Previous config backed up to .config.bak'
+               fi
+               cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
+       fi
+
        if isTrue ${MRPROPER}
        then
                print_info 1 'kernel: >> Running mrproper...'
@@ -39,12 +51,6 @@ config_kernel() {
        # If we're not cleaning, then we don't want to try to overwrite the configs
        # or we might remove configurations someone is trying to test.
 
-       if isTrue "${CLEAN}"
-       then
-               print_info 1 "config: Using config from ${KERNEL_CONFIG}"
-               print_info 1 '        Previous config backed up to .config.bak'
-               cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
-       fi
        if isTrue "${OLDCONFIG}"
        then
                print_info 1 '        >> Running oldconfig...'
@@ -55,7 +61,7 @@ config_kernel() {
                print_info 1 'kernel: >> Cleaning...'
                compile_generic clean kernel
        else
-               print_info 1 "config: --no-clean is enabled; leaving the .config alone."
+               print_info 1 "config: --no-clean is enabled; not running 'make clean'."
        fi
        
        if isTrue ${MENUCONFIG}