Skip to content

Commit 06aa9ff

Browse files
committed
fix(scripts): add xvfb-run detection and fallback for Linux startup
1 parent 100eab0 commit 06aa9ff

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

script/start-linux.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
33
chmod +x $SCRIPT_DIR/llbot/node
44
chmod +x $SCRIPT_DIR/llbot/pmhq
55

6+
# 检测 xvfb-run 命令是否存在
7+
USE_XVFB=1
8+
if ! command -v xvfb-run &> /dev/null; then
9+
echo "未找到 xvfb-run 命令"
10+
echo "如果你是桌面环境,按 Y 继续运行"
11+
echo "如果不是桌面环境,请先安装 xvfb,按其他键退出"
12+
read -n 1 -s -r key
13+
echo ""
14+
if [[ "$key" == "Y" || "$key" == "y" ]]; then
15+
USE_XVFB=0
16+
else
17+
exit 0
18+
fi
19+
fi
20+
621
$SCRIPT_DIR/llbot/node $SCRIPT_DIR/llbot/llonebot.js &
722

8-
xvfb-run $SCRIPT_DIR/llbot/pmhq
23+
if [ $USE_XVFB -eq 1 ]; then
24+
xvfb-run $SCRIPT_DIR/llbot/pmhq
25+
else
26+
$SCRIPT_DIR/llbot/pmhq
27+
fi

0 commit comments

Comments
 (0)