From fff96e47e82dfe475bf6eb05754a50edea1bc8e8 Mon Sep 17 00:00:00 2001 From: Jensfrank Date: Fri, 5 Jul 2024 14:31:20 +0800 Subject: [PATCH] Update Nlbench.sh --- Nlbench.sh | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/Nlbench.sh b/Nlbench.sh index 22be4d5..d91a08b 100644 --- a/Nlbench.sh +++ b/Nlbench.sh @@ -35,23 +35,34 @@ update_scripts() { # 对比版本号 if [ "$REMOTE_VERSION" != "$CURRENT_VERSION" ]; then - echo -e "${BLUE}发现新版本 $REMOTE_VERSION,当前版本 $CURRENT_VERSION${NC}" - echo -e "${BLUE}正在更新...${NC}" + clear + echo "脚本更新日志" + echo "-------------------------" + echo "2024-07-05 v1.0.0" + echo "初始化版本,包含基础功能和菜单选择,一键测试或者手动多选测试" + echo "发现新版本 $REMOTE_VERSION,当前版本 $CURRENT_VERSION" + echo "正在更新..." # 下载新的脚本文件 if curl -s -o /tmp/Nlbench.sh $SCRIPT_URL; then - NEW_VERSION=$(grep '^VERSION=' /tmp/Nlbench.sh | cut -d'"' -f2) - sed -i "s/^CURRENT_VERSION=.*/CURRENT_VERSION=\"$NEW_VERSION\"/" "$0" - - # 替换脚本文件 - if mv /tmp/Nlbench.sh "$0"; then - chmod +x "$0" - echo -e "${GREEN}脚本更新成功!新版本: $NEW_VERSION${NC}" - echo -e "${YELLOW}请等待 3 秒...${NC}" - sleep 3 - exec bash "$0" + if [ -f /tmp/Nlbench.sh ]; then + NEW_VERSION=$(grep '^VERSION=' /tmp/Nlbench.sh | cut -d'"' -f2) + sed -i "s/^CURRENT_VERSION=.*/CURRENT_VERSION=\"$NEW_VERSION\"/" "$0" + + # 替换脚本文件 + if mv /tmp/Nlbench.sh "$0"; then + chmod +x "$0" + echo -e "${GREEN}脚本更新成功!新版本: $NEW_VERSION${NC}" + echo -e "${YELLOW}请等待 3 秒...${NC}" + sleep 3 + exec bash "$0" + else + echo -e "${RED}无法替换脚本文件。请检查权限。${NC}" + sleep 2 + return 1 + fi else - echo -e "${RED}无法替换脚本文件。请检查权限。${NC}" + echo -e "${RED}下载的新脚本文件不存在。请检查下载过程。${NC}" sleep 2 return 1 fi @@ -66,6 +77,7 @@ update_scripts() { fi } + # 检查并安装依赖 install_dependencies() { echo -e "${YELLOW}正在检查并安装必要的依赖项...${NC}"