From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 99306138334 for ; Sun, 24 Nov 2019 20:00:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8A669E0878; Sun, 24 Nov 2019 20:00:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5C7FFE0878 for ; Sun, 24 Nov 2019 20:00:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 43EFB34D2DD for ; Sun, 24 Nov 2019 20:00:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4836D8CA for ; Sun, 24 Nov 2019 20:00:13 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1574625556.547207d7db8c6ab5418cb09b6da3afbed0b6e146.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_compile.sh gen_determineargs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 547207d7db8c6ab5418cb09b6da3afbed0b6e146 X-VCS-Branch: master Date: Sun, 24 Nov 2019 20:00:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a746de0d-8572-4266-a451-8e0719fb1993 X-Archives-Hash: 4d5b695773f119a1c0903a13f2fda3c2 commit: 547207d7db8c6ab5418cb09b6da3afbed0b6e146 Author: Thomas Deutschmann gentoo org> AuthorDate: Thu Nov 21 00:00:45 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Nov 24 19:59:16 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=547207d7 gen_compile.sh: determine_busybox_config_file(): Move --busybox-config validation to determine_real_args() This will allow us to fail early. Signed-off-by: Thomas Deutschmann gentoo.org> gen_compile.sh | 83 ++++++++++++++++++++-------------------------------- gen_determineargs.sh | 19 ++++++++++++ 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/gen_compile.sh b/gen_compile.sh index c782f9b..9c6b6f0 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -342,68 +342,47 @@ compile_kernel() { } determine_busybox_config_file() { - print_info 2 "$(get_indent 2)busybox: >> Checking for suitable busybox configuration ..." - - if [ -n "${CMD_BUSYBOX_CONFIG}" ] + if [ -n "${BUSYBOX_CONFIG}" ] then - BUSYBOX_CONFIG=$(expand_file "${CMD_BUSYBOX_CONFIG}") - if [ -z "${BUSYBOX_CONFIG}" ] - then - error_msg="No busybox .config: Cannot use '${CMD_BUSYBOX_CONFIG}' value. " - error_msg+="Check --busybox-config value or unset " - error_msg+="to use default busybox config provided by genkernel." - gen_die "${error_msg}" - fi - else - local -a bbconfig_candidates=() - local busybox_version=$(get_gkpkg_version busybox) + print_info 2 "$(get_indent 2)busybox: >> Using user-specified busybox configuration from '${BUSYBOX_CONFIG}' ..." + return + fi - if isTrue "${NETBOOT}" - then - bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config-${busybox_version}")" ) - bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")" ) - bbconfig_candidates+=( "${GK_SHARE}/netboot/busy-config-${busybox_version}" ) - bbconfig_candidates+=( "${GK_SHARE}/netboot/busy-config" ) - fi - bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config-${busybox_version}")" ) - bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")" ) - bbconfig_candidates+=( "${GK_SHARE}/defaults/busy-config-${busybox_version}" ) - bbconfig_candidates+=( "${GK_SHARE}/defaults/busy-config" ) + print_info 2 "$(get_indent 2)busybox: >> Checking for suitable busybox configuration ..." - local f - for f in "${bbconfig_candidates[@]}" - do - [ -z "${f}" ] && continue + local -a bbconfig_candidates=() + local busybox_version=$(get_gkpkg_version busybox) - if [ -f "${f}" ] - then - BUSYBOX_CONFIG="$f" - break - else - print_info 3 "$(get_indent 3)- '${f}' not found; Skipping ..." - fi - done - - if [ -z "${BUSYBOX_CONFIG}" ] - then - gen_die 'No busybox .config specified, or file not found!' - fi + if isTrue "${NETBOOT}" + then + bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config-${busybox_version}")" ) + bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/netboot-busy-config")" ) + bbconfig_candidates+=( "${GK_SHARE}/netboot/busy-config-${busybox_version}" ) + bbconfig_candidates+=( "${GK_SHARE}/netboot/busy-config" ) fi + bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config-${busybox_version}")" ) + bbconfig_candidates+=( "$(arch_replace "${GK_SHARE}/arch/%%ARCH%%/busy-config")" ) + bbconfig_candidates+=( "${GK_SHARE}/defaults/busy-config-${busybox_version}" ) + bbconfig_candidates+=( "${GK_SHARE}/defaults/busy-config" ) - BUSYBOX_CONFIG="$(readlink -f "${BUSYBOX_CONFIG}")" + local f + for f in "${bbconfig_candidates[@]}" + do + [ -z "${f}" ] && continue - # Validate the symlink result if any - if [ -z "${BUSYBOX_CONFIG}" -o ! -f "${BUSYBOX_CONFIG}" ] - then - if [ -n "${CMD_BUSYBOX_CONFIG}" ] + if [ -f "${f}" ] then - error_msg="No busybox .config: File '${CMD_BUSYBOX_CONFIG}' not found! " - error_msg+="Check --busybox-config value or unset " - error_msg+="to use default busybox config provided by genkernel." - gen_die "${error_msg}" + BUSYBOX_CONFIG="$f" + break else - gen_die "No busybox .config: symlinked file '${BUSYBOX_CONFIG}' not found!" + print_info 3 "$(get_indent 3)- '${f}' not found; Skipping ..." fi + done + + if [ -z "${BUSYBOX_CONFIG}" ] + then + # Sanity check + gen_die 'No busybox .config specified or file not found!' fi } diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 5bbe33f..2b68a8a 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -923,6 +923,25 @@ determine_real_args() { fi done unset FEATURE_REQUIRING_BUSYBOX FEATURES_REQUIRING_BUSYBOX + elif [ -n "${CMD_BUSYBOX_CONFIG}" ] + then + local BUSYBOX_CONFIG=$(expand_file "${CMD_BUSYBOX_CONFIG}") + if [ -z "${BUSYBOX_CONFIG}" ] + then + gen_die "--busybox-config value '${CMD_BUSYBOX_CONFIG}' failed to expand!" + elif [ ! -e "${BUSYBOX_CONFIG}" ] + then + gen_die "--busybox-config file '${BUSYBOX_CONFIG}' does not exist!" + fi + + if ! grep -qE '^CONFIG_.*=' "${BUSYBOX_CONFIG}" &>/dev/null + then + gen_die "--busybox-config file '${BUSYBOX_CONFIG}' does not look like a valid busybox config: File does not contain any CONFIG_* value!" + elif ! grep -qE '^CONFIG_STATIC=y$' "${BUSYBOX_CONFIG}" &>/dev/null + then + # We cannot check all required options but check at least for CONFIG_STATIC... + gen_die "--busybox-config file '${BUSYBOX_CONFIG}' does not contain CONFIG_STATIC=y. This busybox config will not work with genkernel!" + fi fi DU_COMMAND="$(which du 2>/dev/null)"