From 9bbe468c9151d611040ccb26839464d203f2b45d Mon Sep 17 00:00:00 2001 From: shaw Date: Sun, 28 Dec 2025 12:25:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E9=80=9A=E8=BF=87=20pipe=20=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=20root=20=E6=9D=83=E9=99=90=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用 `id -u` 替代 `$EUID` 进行 root 权限检查。 `$EUID` 是 bash 内置变量,在通过 pipe 执行脚本时可能不可靠。 --- deploy/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/install.sh b/deploy/install.sh index 4f4f9161..6dcf4123 100644 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -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