From 41d85348a42bf0ba45ec763de48670c5944c4a80 Mon Sep 17 00:00:00 2001 From: hayao Date: Sat, 7 Nov 2020 21:31:51 +0900 Subject: [PATCH] [update] : Get the TUI kernel list using kernel.sh --- tools/kernel-choice-conf-gen.sh | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/tools/kernel-choice-conf-gen.sh b/tools/kernel-choice-conf-gen.sh index e68a452e..32147429 100755 --- a/tools/kernel-choice-conf-gen.sh +++ b/tools/kernel-choice-conf-gen.sh @@ -1,12 +1,32 @@ #!/usr/bin/env bash -script_path=`dirname $0` -cd ${script_path} -rm -f menuconfig-script/kernel_choice_i686 -rm -f menuconfig-script/kernel_choice_x86_64 -for list in ${script_path}/system/kernel-* ; do - arch="${list#${script_path}/system/kernel-}" - for kernel in $(grep -h -v ^'#' ${list} | awk '{print $1}'); do - echo "config KERNEL_N_A_M_E_${kernel}" >> "menuconfig-script/kernel_choice_${arch}" - echo -e "\tbool ${kernel}" >> "menuconfig-script/kernel_choice_${arch}" + +script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )" +arch_list=( + "x86_64" + "i686" +) + +# rm helper +# Delete the file if it exists. +# For directories, rm -rf is used. +# If the file does not exist, skip it. +# remove ... +remove() { + local _list=($(echo "$@")) _file + for _file in "${_list[@]}"; do + if [[ -f "${_file}" ]]; then + rm -f "${_file}" + elif [[ -d "${_file}" ]]; then + rm -rf "${_file}" + fi + done +} + +#cd "${script_path}" +for arch in ${arch_list[@]}; do + remove "${script_path}/menuconfig-script/kernel_choice_${arch}" + for kernel in $(bash "${script_path}/tools/kernel.sh" -a "${arch}" show ); do + echo "config KERNEL_N_A_M_E_${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}" + echo -e "\tbool ${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}" done done -- 2.11.0