Fix: script execution via curl pipe
- Detect non-interactive execution (curl pipe) and auto-run full install
- Use -t 0 to check if stdin is a terminal
- Add fallback condition for BASH_SOURCE detection
- Ensures one-liner curl command works properly
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
bc50c78353
commit
faa6c58d90
18
install.sh
18
install.sh
|
@ -360,15 +360,22 @@ config_only() {
|
|||
print_message "✅ 配置完成!" "$GREEN"
|
||||
}
|
||||
|
||||
# 检查是否为交互式调用
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
# 主执行逻辑
|
||||
main() {
|
||||
# 如果有参数,直接运行完整安装
|
||||
if [[ $# -gt 0 && $1 == "--full" ]]; then
|
||||
full_install
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 显示菜单
|
||||
# 如果是通过 curl 管道执行(非交互式),默认运行完整安装
|
||||
if [[ ! -t 0 ]]; then
|
||||
print_message "🔍 检测到非交互式执行,运行完整安装..." "$YELLOW"
|
||||
full_install
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 交互式菜单
|
||||
while true; do
|
||||
show_menu
|
||||
|
||||
|
@ -398,4 +405,9 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# 只有在脚本被直接执行时才运行主函数
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]] || [[ -z "${BASH_SOURCE[0]}" ]]; then
|
||||
main "$@"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user