Rework WIP boards selection menu

Fix (hopefully) CREATE_PATCHES for u-boot
This commit is contained in:
zador-blood-stained 2016-12-19 22:04:58 +03:00
parent 34eacbb30c
commit 7a79556dd2
2 changed files with 28 additions and 16 deletions

View File

@ -470,7 +470,7 @@ userpatch_create()
# prompt to alter source
display_alert "Make your changes in this directory:" "$(pwd)" "wrn"
display_alert "Press <Enter> after you are done" "waiting" "wrn"
read
read </dev/tty
tput cuu1
git add .
# create patch out of changes

42
main.sh
View File

@ -95,33 +95,45 @@ prepare_host
# if KERNEL_ONLY, BOARD, BRANCH or RELEASE are not set, display selection menu
# add extra button if we have wip conf files
if [[ ! -z `ls $SRC/lib/config/boards/*.wip 2> /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"