diff --git a/common.sh b/common.sh index 2743b85e0a..b5a04bf7cf 100644 --- a/common.sh +++ b/common.sh @@ -470,7 +470,7 @@ userpatch_create() # prompt to alter source display_alert "Make your changes in this directory:" "$(pwd)" "wrn" display_alert "Press after you are done" "waiting" "wrn" - read + read /dev/null` ]]; then EXTRAFIELD="--extra-button --extra-label WIP"; fi - if [[ -z $KERNEL_ONLY ]]; then options+=("yes" "Kernel and u-boot packages") options+=("no" "OS image for installation to SD card") - KERNEL_ONLY=$(dialog ${EXTRAFIELD} --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" \ + KERNEL_ONLY=$(dialog $EXTRAFIELD --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" \ $TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}") - if [ $? == 3 ]; then PATTERN="*.wip"; else PATTERN="*.conf"; fi unset options [[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected" fi +EXT='conf' if [[ -z $BOARD ]]; then - options=() - - for board in $SRC/lib/config/boards/$PATTERN; do - options+=("$(basename $board | cut -d'.' -f1)" "$(head -1 $board | cut -d'#' -f2)") + WIP_STATE='supported' + [[ -n $(find $SRC/lib/config/boards/ -name '*.wip' -print -quit) ]] && DIALOG_EXTRA='--extra-button --extra-label Supported/WIP' + while true; do + options=() + for board in $SRC/lib/config/boards/*.${EXT}; do + options+=("$(basename $board | cut -d'.' -f1)" "$(head -1 $board | cut -d'#' -f2)") + done + BOARD=$(dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar $DIALOG_EXTRA \ + --menu "Select the target board\nDisplaying $WIP_STATE boards" $TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}") + STATUS=$? + if [[ $STATUS == 3 ]]; then + if [[ $WIP_STATE == supported ]]; then + WIP_STATE='work-in-progress' + EXT='wip' + else + WIP_STATE='supported' + EXT='conf' + fi + continue + elif [[ $STATUS == 0 ]]; then + break + fi + unset options + [[ -z $BOARD ]] && exit_with_error "No board selected" done - - BOARD=$(dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar --menu "Select the target board" \ - $TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}") - unset options - [[ -z $BOARD ]] && exit_with_error "No board selected" fi -source $SRC/lib/config/boards/$BOARD.conf 2> /dev/null || source $SRC/lib/config/boards/$BOARD.wip +source $SRC/lib/config/boards/${BOARD}.${EXT} [[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"