ql bot添加重置remote地址

This commit is contained in:
hanhh 2021-06-21 22:41:19 +08:00
parent 173b87a7b1
commit c9fecae67a
3 changed files with 18 additions and 17 deletions

View File

@ -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}

View File

@ -299,6 +299,23 @@ git_pull_scripts() {
cd $dir_current
}
## 重置仓库remote urldocker专用$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

View File

@ -7,23 +7,6 @@ dir_shell=/ql/shell
send_mark=$dir_shell/send_mark
## 重置仓库remote urldocker专用$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脚本清单文件路径$2cron任务清单文件路径$3增加任务清单文件路径$4删除任务清单文件路径
diff_cron() {
local list_scripts="$1"