From 19b52c1f63dde88cc6fed16830d5ea5235528a5b Mon Sep 17 00:00:00 2001 From: Yaraslau Furman Date: Fri, 22 Nov 2024 15:21:35 +0200 Subject: [PATCH] Allow modifying current defconfig Allow copying the current config and modifying it by running: _use_current=y _makenconfig=y (or other config modifier). --- PKGBUILD | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 0395a7f..9a3e9bf 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -176,6 +176,13 @@ apply_patches() { done } +# Allows user to modify the kernel config +modify_defconfig() { + [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig + [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig + [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig +} + # Copies the kernel config copy_defconfig() { local "_cur_major_ver=$(zcat /proc/config.gz | grep Linux | grep -o '[0-9]*[0-9]\.[0-9]*[0-9]')" @@ -186,6 +193,9 @@ copy_defconfig() { # modprobe configs zcat /proc/config.gz > ./.config make ${BUILD_FLAGS[*]} olddefconfig + + # If a user wants to modify the config based on the current one + modify_defconfig else warning "Your kernel was not compiled with IKCONFIG_PROC." warning "Unable to read kernel configuration, aborting." @@ -293,9 +303,7 @@ update_defconfig() { [[ -z "${_subarch}" ]] && make ${BUILD_FLAGS[*]} oldconfig # Open configuration editors - [[ -n "$_makemenuconfig" ]] && make ${BUILD_FLAGS[*]} menuconfig - [[ -n "$_makexconfig" ]] && make ${BUILD_FLAGS[*]} xconfig - [[ -n "$_makenconfig" ]] && make ${BUILD_FLAGS[*]} nconfig + modify_defconfig # Save configuration # shellcheck disable=SC2015