From 81fe1224df767a6cb16f40ec6435f5c1f31f0816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 26 Apr 2026 21:39:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20cp=5Fdist=5Fmoicen=20=E7=94=A8?= =?UTF-8?q?=20hostname=20=E4=B8=8E=20POSIX=20=E5=88=A4=E6=96=AD=EF=BC=8C?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=20build:moicen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免 SSH 非登录环境下 HOSTNAME 为空导致 npm run build: 失败;/bin/sh 下 [[ 不可用。 Made-with: Cursor --- cp_dist_moicen.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cp_dist_moicen.sh b/cp_dist_moicen.sh index 6d27fd2..7d3290d 100755 --- a/cp_dist_moicen.sh +++ b/cp_dist_moicen.sh @@ -8,15 +8,16 @@ openresty_html_dir='/usr/local/openresty/nginx/html/music-room' mkdir -p $openresty_html_dir -CUR_HOST=$(echo $HOSTNAME | cut -d "." -f 1) +# 使用 hostname(非 $HOSTNAME):非登录 SSH 下 HOSTNAME 常为空,会导致误跑成 npm run build: +CUR_HOST=$(hostname | cut -d. -f1) -if [[ "$CUR_HOST" != "moicen" ]]; then +if [ "$CUR_HOST" != "moicen" ]; then echo "HOST ${CUR_HOST} is not moicen!" exit 1 fi rm -rf node_modules && pnpm install -npm run build:$CUR_HOST +npm run build:moicen sudo cp -r ./dist/* $openresty_html_dir