From dfddd742bda34ceea56b494675ca17754c8bdff2 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 13 Jan 2011 14:29:23 +0100 Subject: [PATCH] Handle missing kernel .config better (bug #271528) --- gen_configkernel.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 8c00f8d..ee76ec1 100755 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -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} -- 2.26.2