更新bot启动脚本

This commit is contained in:
whyour
2021-05-10 22:21:22 +08:00
parent af8d52744e
commit 25369e1aa8
3 changed files with 38 additions and 31 deletions
+24
View File
@@ -252,6 +252,30 @@ update_depend() {
cd $dir_current
}
## 克隆脚本,$1:仓库地址,$2:仓库保存路径,$3:分支(可省略)
git_clone_scripts() {
local url=$1
local dir=$2
local branch=$3
[[ $branch ]] && local cmd="-b $branch "
echo -e "开始克隆仓库 $url$dir\n"
git clone $cmd $url $dir
exit_status=$?
}
## 更新脚本,$1:仓库保存路径
git_pull_scripts() {
local dir_current=$(pwd)
local dir_work=$1
cd $dir_work
echo -e "开始更新仓库:$dir_work\n"
git fetch --all
exit_status=$?
git reset --hard
git pull
cd $dir_current
}
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
detect_termux
detect_macos