Add expert mode warning for dialog selections
This commit is contained in:
parent
1d54563639
commit
1345b043ed
22
general.sh
22
general.sh
@ -631,3 +631,25 @@ download_toolchain()
|
||||
display_alert "Verification failed" "" "wrn"
|
||||
fi
|
||||
}
|
||||
|
||||
show_developer_warning()
|
||||
{
|
||||
local temp_rc=$(mktemp)
|
||||
cat <<-'EOF' > $temp_rc
|
||||
screen_color = (WHITE,RED,ON)
|
||||
EOF
|
||||
local warn_text="You are switching to the \Z1EXPERT MODE\Zn
|
||||
|
||||
This allows building experimental configurations that are provided
|
||||
\Z1AS IS\Zn to developers and expert users,
|
||||
\Z1WITHOUT ANY RESPONSIBILITIES\Zn from the Armbian team:
|
||||
|
||||
- You are using these configurations \Z1AT YOUR OWN RISK\Zn
|
||||
- Issues related to the dev kernel, WIP and EOS boards \Z1will be closed without a discussion\Zn
|
||||
- Forum threads and posts related to dev kernel, WIP and EOS boards \Z1may be moved and ignored\Zn
|
||||
"
|
||||
DIALOGRC=$temp_rc dialog --title "Expert mode warning" --backtitle "$backtitle" --colors --defaultno --no-label "I do not agree" \
|
||||
--yes-label "I understand and agree" --yesno "$warn_text" $TTY_Y $TTY_X
|
||||
[[ $? -ne 0 ]] && exit_with_error "Error switching to the expert mode"
|
||||
SHOW_WARNING=no
|
||||
}
|
||||
|
||||
19
main.sh
19
main.sh
@ -80,6 +80,8 @@ elif [[ $PROGRESS_DISPLAY != plain ]]; then
|
||||
fi
|
||||
if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
|
||||
|
||||
SHOW_WARNING=yes
|
||||
|
||||
if [[ $USE_CCACHE != no ]]; then
|
||||
CCACHE=ccache
|
||||
export PATH="/usr/lib/ccache:$PATH"
|
||||
@ -125,17 +127,17 @@ if [[ -z $BOARD ]]; then
|
||||
done
|
||||
else
|
||||
for board in $SRC/lib/config/boards/*.wip; do
|
||||
options+=("$(basename $board | cut -d'.' -f1)" "(WIP) $(head -1 $board | cut -d'#' -f2)")
|
||||
options+=("$(basename $board | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 $board | cut -d'#' -f2)")
|
||||
done
|
||||
for board in $SRC/lib/config/boards/*.eos; do
|
||||
options+=("$(basename $board | cut -d'.' -f1)" "(EOS) $(head -1 $board | cut -d'#' -f2)")
|
||||
options+=("$(basename $board | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 $board | cut -d'#' -f2)")
|
||||
done
|
||||
fi
|
||||
if [[ $WIP_STATE != supported ]]; then
|
||||
cat <<-'EOF' > $temp_rc
|
||||
dialog_color = (RED,WHITE,OFF)
|
||||
screen_color = (WHITE,RED,ON)
|
||||
item_color = (RED,WHITE,ON)
|
||||
tag_color = (RED,WHITE,ON)
|
||||
item_selected_color = (WHITE,RED,ON)
|
||||
tag_selected_color = (WHITE,RED,ON)
|
||||
tag_key_selected_color = (WHITE,RED,ON)
|
||||
@ -143,11 +145,13 @@ if [[ -z $BOARD ]]; then
|
||||
else
|
||||
echo > $temp_rc
|
||||
fi
|
||||
BOARD=$(DIALOGRC=$temp_rc dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar --extra-label "Show $WIP_BUTTON" $DIALOG_EXTRA \
|
||||
--menu "Select the target board\nDisplaying $WIP_STATE boards" $TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
||||
BOARD=$(DIALOGRC=$temp_rc dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar --colors \
|
||||
--extra-label "Show $WIP_BUTTON" $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
|
||||
[[ $SHOW_WARNING == yes ]] && show_developer_warning
|
||||
WIP_STATE='Work-In-Progress and End-Of-Support'
|
||||
WIP_BUTTON='supported'
|
||||
else
|
||||
@ -179,17 +183,18 @@ if [[ -z $BRANCH ]]; then
|
||||
options=()
|
||||
[[ $KERNEL_TARGET == *default* ]] && options+=("default" "Vendor provided / legacy (3.4.x - 4.4.x)")
|
||||
[[ $KERNEL_TARGET == *next* ]] && options+=("next" "Mainline (@kernel.org) (4.x)")
|
||||
[[ $KERNEL_TARGET == *dev* && $EXPERT=yes ]] && options+=("dev" "Development version (4.x)")
|
||||
[[ $KERNEL_TARGET == *dev* && $EXPERT=yes ]] && options+=("dev" "\Z1Development version (4.x)\Zn")
|
||||
# do not display selection dialog if only one kernel branch is available
|
||||
if [[ "${#options[@]}" == 2 ]]; then
|
||||
BRANCH="${options[0]}"
|
||||
else
|
||||
BRANCH=$(dialog --stdout --title "Choose a kernel" --backtitle "$backtitle" \
|
||||
BRANCH=$(dialog --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
|
||||
--menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
|
||||
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
||||
fi
|
||||
unset options
|
||||
[[ -z $BRANCH ]] && exit_with_error "No kernel branch selected"
|
||||
[[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
|
||||
else
|
||||
[[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user