修改update对应分支

This commit is contained in:
whyour 2022-03-05 11:46:21 +08:00
parent 810c6ca76c
commit 8dfbe93135
2 changed files with 13 additions and 12 deletions

View File

@ -225,7 +225,7 @@ fix_config() {
if [[ -s /etc/nginx/conf.d/default.conf ]]; then
echo -e "检测到默认nginx配置文件清空...\n"
cat /dev/null > /etc/nginx/conf.d/default.conf
cat /dev/null >/etc/nginx/conf.d/default.conf
echo
fi
@ -240,7 +240,7 @@ fix_config() {
cp -fv $file_notify_py_sample $dep_notify_py
echo
fi
}
npm_install_sub() {
@ -305,7 +305,7 @@ git_clone_scripts() {
local branch=$3
[[ $branch ]] && local part_cmd="-b $branch "
echo -e "开始克隆仓库 $url$dir\n"
set_proxy
git clone $part_cmd $url $dir
exit_status=$?
@ -316,17 +316,17 @@ git_pull_scripts() {
local dir_current=$(pwd)
local dir_work="$1"
local branch="$2"
[[ $branch ]] && git checkout ${branch}
[[ $branch ]] && local part_cmd="origin/${branch}"
cd $dir_work
echo -e "开始更新仓库:$dir_work\n"
set_proxy
git fetch --all
exit_status=$?
git reset --hard &>/dev/null
git pull --allow-unrelated-histories &>/dev/null
git reset --hard $part_cmd
git pull
unset_proxy
cd $dir_current
}
@ -359,4 +359,4 @@ detect_macos
define_cmd
fix_config
import_config $1 > $task_error_log_path 2>&1
import_config $1 >$task_error_log_path 2>&1

View File

@ -246,9 +246,10 @@ update_qinglong() {
pnpm install -g pm2 &>/dev/null
local no_restart="$1"
local primary_branch="master"
[[ -f $dir_root/package.json ]] && ql_depend_old=$(cat $dir_root/package.json)
reset_romote_url ${dir_root} "https://github.com/whyour/qinglong.git" ${current_branch}
git_pull_scripts $dir_root ${current_branch}
reset_romote_url ${dir_root} "https://github.com/whyour/qinglong.git" ${primary_branch}
git_pull_scripts $dir_root ${primary_branch}
if [[ $exit_status -eq 0 ]]; then
echo -e "\n更新$dir_root成功...\n"
@ -264,8 +265,8 @@ update_qinglong() {
local url="https://github.com/whyour/qinglong-static.git"
if [[ -d ${ql_static_repo}/.git ]]; then
reset_romote_url ${ql_static_repo} ${url} ${current_branch}
git_pull_scripts ${ql_static_repo} ${current_branch}
reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
git_pull_scripts ${ql_static_repo} ${primary_branch}
else
git_clone_scripts ${url} ${ql_static_repo}
fi