update.sh: fallback to main if dev not exists

This commit is contained in:
Dict Xiong 2022-11-20 11:50:33 +08:00
parent cb98842736
commit 70ea2ad9cb

View File

@ -19,7 +19,7 @@ fi
# get the specified commit id # get the specified commit id
case $DFS_UPDATE_CHANNEL in case $DFS_UPDATE_CHANNEL in
"main" ) DFS_COMMIT=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id) ;; "main" ) DFS_COMMIT=$(curl -fsSL https://api.beardic.cn/get-var/dfs-commit-id) ;;
"dev" ) DFS_COMMIT=$(git rev-parse origin/dev) ;; "dev" ) DFS_COMMIT=$(git rev-parse origin/dev 2> /dev/null) || DFS_COMMIT=$(git rev-parse origin/main) ;;
"latest" ) DFS_COMMIT=$(git for-each-ref --sort=-committerdate refs/heads refs/remotes --format='%(objectname)' | head -n 1) ;; "latest" ) DFS_COMMIT=$(git for-each-ref --sort=-committerdate refs/heads refs/remotes --format='%(objectname)' | head -n 1) ;;
* ) fmt_fatal "invalid update channel: $DFS_UPDATE_CHANNEL" ;; * ) fmt_fatal "invalid update channel: $DFS_UPDATE_CHANNEL" ;;
esac esac