Files
BootRepairTool/dist/LinuxGrubRepair
2026-02-14 14:39:44 +08:00

37 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ==============================================================================
# BootRepairTool 启动脚本
# 解决 Arch Linux 等系统上的 X11 字体渲染问题
# ==============================================================================
# 获取脚本实际所在目录(处理软链接情况)
SCRIPT_SOURCE="${BASH_SOURCE[0]}"
while [ -L "$SCRIPT_SOURCE" ]; do
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
SCRIPT_SOURCE="$(readlink "$SCRIPT_SOURCE")"
[[ $SCRIPT_SOURCE != /* ]] && SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_SOURCE"
done
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
# 如果是从 /bin 软链接启动,则使用实际安装目录
if [ "$SCRIPT_DIR" = "/bin" ] || [ "$SCRIPT_DIR" = "/usr/bin" ]; then
SCRIPT_DIR="/opt/boot-repair-tool"
fi
# 设置字体渲染环境变量,解决 "BadLength (poly request too large)" 错误
export XLIB_SKIP_ARGB_VISUALS=1
# 禁用某些 X11 RENDER 扩展功能
export GDK_NATIVE_WINDOWS=1
# 设置 tkinter 使用基本字体渲染
export TCL_DONT_USE_RENDER_EXTENSION=1
# 如果使用 Wayland强制使用 XWayland
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export GDK_BACKEND=x11
fi
# 执行实际程序
exec "${SCRIPT_DIR}/LinuxGrubRepair.bin" "$@"