mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
ql bot添加重置remote地址
This commit is contained in:
parent
173b87a7b1
commit
c9fecae67a
|
@ -12,6 +12,7 @@ echo -e "\nbot依赖安装成功...\n"
|
||||||
|
|
||||||
echo -e "2、下载bot所需文件...\n"
|
echo -e "2、下载bot所需文件...\n"
|
||||||
if [ -d ${repo_path}/.git ]; then
|
if [ -d ${repo_path}/.git ]; then
|
||||||
|
reset_romote_url ${repo_path} "${url}"
|
||||||
git_pull_scripts ${repo_path}
|
git_pull_scripts ${repo_path}
|
||||||
else
|
else
|
||||||
rm -rf ${repo_path}
|
rm -rf ${repo_path}
|
||||||
|
|
|
@ -299,6 +299,23 @@ git_pull_scripts() {
|
||||||
cd $dir_current
|
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_termux
|
||||||
detect_macos
|
detect_macos
|
||||||
|
|
|
@ -7,23 +7,6 @@ dir_shell=/ql/shell
|
||||||
|
|
||||||
send_mark=$dir_shell/send_mark
|
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:删除任务清单文件路径
|
## 检测cron的差异,$1:脚本清单文件路径,$2:cron任务清单文件路径,$3:增加任务清单文件路径,$4:删除任务清单文件路径
|
||||||
diff_cron() {
|
diff_cron() {
|
||||||
local list_scripts="$1"
|
local list_scripts="$1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user