From c9fecae67a42a627e091d2ca52ac5eb006e0f133 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Mon, 21 Jun 2021 22:41:19 +0800 Subject: [PATCH] =?UTF-8?q?ql=20bot=E6=B7=BB=E5=8A=A0=E9=87=8D=E7=BD=AErem?= =?UTF-8?q?ote=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/bot.sh | 1 + shell/share.sh | 17 +++++++++++++++++ shell/update.sh | 17 ----------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/shell/bot.sh b/shell/bot.sh index c6b71d05..373ec42c 100644 --- a/shell/bot.sh +++ b/shell/bot.sh @@ -12,6 +12,7 @@ echo -e "\nbot依赖安装成功...\n" echo -e "2、下载bot所需文件...\n" if [ -d ${repo_path}/.git ]; then + reset_romote_url ${repo_path} "${url}" git_pull_scripts ${repo_path} else rm -rf ${repo_path} diff --git a/shell/share.sh b/shell/share.sh index ef099ca6..704c2b0e 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -299,6 +299,23 @@ git_pull_scripts() { cd $dir_current } +## 重置仓库remote url,docker专用,$1:要重置的目录,$2:要重置为的网址 +reset_romote_url() { + local dir_current=$(pwd) + local dir_work=$1 + local url=$2 + local branch="$3" + + [[ $branch ]] && local cmd="origin/${branch}" + + if [ -d "$dir_work/.git" ]; then + cd $dir_work + git remote set-url origin $url >/dev/null + git reset --hard $cmd >/dev/null + cd $dir_current + fi +} + ## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件 detect_termux detect_macos diff --git a/shell/update.sh b/shell/update.sh index 5c5ef2d4..9bd267c2 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -7,23 +7,6 @@ dir_shell=/ql/shell send_mark=$dir_shell/send_mark -## 重置仓库remote url,docker专用,$1:要重置的目录,$2:要重置为的网址 -reset_romote_url() { - local dir_current=$(pwd) - local dir_work=$1 - local url=$2 - local branch="$3" - - [[ $branch ]] && local cmd="origin/${branch}" - - if [ -d "$dir_work/.git" ]; then - cd $dir_work - git remote set-url origin $url >/dev/null - git reset --hard $cmd >/dev/null - cd $dir_current - fi -} - ## 检测cron的差异,$1:脚本清单文件路径,$2:cron任务清单文件路径,$3:增加任务清单文件路径,$4:删除任务清单文件路径 diff_cron() { local list_scripts="$1"