Skip to content

Commit 8744905

Browse files
committed
bug fix
1 parent 9694ce0 commit 8744905

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

run.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,31 @@ show_help() {
3838
log_info " --help 显示此帮助信息"
3939
}
4040

41+
# 安装 yq 函数
42+
install_yq() {
43+
if ! command -v yq &> /dev/null; then
44+
log_info "正在安装 yq..."
45+
if wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64; then
46+
chmod +x /usr/local/bin/yq
47+
log_info "yq 安装成功"
48+
else
49+
log_error "yq 下载失败"
50+
return 1
51+
fi
52+
fi
53+
return 0
54+
}
55+
4156
# 检查依赖工具是否安装
4257
check_dependencies() {
43-
local dependencies=("yq" "jq")
58+
# 首先安装 yq
59+
install_yq || {
60+
log_error "yq 安装失败"
61+
exit 1
62+
}
63+
64+
# 检查其他依赖
65+
local dependencies=("jq")
4466
for dep in "${dependencies[@]}"; do
4567
if ! command -v "$dep" &> /dev/null; then
4668
log_info "正在安装 $dep..."

0 commit comments

Comments
 (0)