From fb427d94e28b9c78cd1d47edf4423125bef56784 Mon Sep 17 00:00:00 2001 From: Cookie987 Date: Fri, 4 Apr 2025 22:04:39 +0800 Subject: [PATCH] Update scripts/run.sh Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- scripts/run.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index 8babf0888..c1fe4973f 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -369,18 +369,28 @@ run_installation() { # 选择分支 choose_branch() { - BRANCH=$(whiptail --title "🔀 选择分支" --radiolist "请选择要安装的分支:" 15 60 4 \ - "main" "稳定最新版(推荐)" ON \ - "classical" "经典版" OFF \ - "custom" "自定义分支" OFF 3>&1 1>&2 2>&3) + BRANCH=$(whiptail --title "🔀 选择分支" --radiolist "请选择要安装的分支:" 15 60 4 \ + "main" "稳定最新版(推荐)" ON \ + "classical" "经典版" OFF \ + "custom" "自定义分支" OFF 3>&1 1>&2 2>&3) + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + whiptail --msgbox "操作取消!" 10 60 + exit 1 + fi - if [[ "$BRANCH" == "custom" ]]; then - BRANCH=$(whiptail --title "🔀 自定义分支" --inputbox "请输入自定义分支名称:" 10 60 "refactor" 3>&1 1>&2 2>&3) - [[ -z "$BRANCH" ]] && { + if [[ "$BRANCH" == "custom" ]]; then + BRANCH=$(whiptail --title "🔀 自定义分支" --inputbox "请输入自定义分支名称:" 10 60 "refactor" 3>&1 1>&2 2>&3) + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + whiptail --msgbox "输入取消!" 10 60 + exit 1 + fi + if [[ -z "$BRANCH" ]]; then whiptail --msgbox "🚫 分支名称不能为空!" 10 60 exit 1 - } fi + fi } choose_branch