Commit 9bbe468c authored by shaw's avatar shaw
Browse files

fix: 修复安装脚本通过 pipe 执行时 root 权限检查失效的问题

使用 `id -u` 替代 `$EUID` 进行 root 权限检查。
`$EUID` 是 bash 内置变量,在通过 pipe 执行脚本时可能不可靠。
parent fbdff4f3
......@@ -404,7 +404,9 @@ configure_server() {
# Check if running as root
check_root() {
if [ "$EUID" -ne 0 ]; then
# Use 'id -u' instead of $EUID for better compatibility
# $EUID may not work reliably when script is piped to bash
if [ "$(id -u)" -ne 0 ]; then
print_error "$(msg 'run_as_root')"
exit 1
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment