Files
agent/skills/image-process/install.sh
T
kicer 69a1ee0bdf refactor(skills): img-utils 改名 image-process;office 标记 required
- image-process:原名 img-utils 的 "utils" 没有边界,且和 image_task(AI 生成)
  只差一个语义,容易让模型把确定性处理当成生成能力。目录名即技能名
  (listSkills 取 e.name、skillDir 按名解析),同步 SKILL.md、run.py 注释与
  skills/README.md 的两处引用。
- office:加 required: true,避免模型绕过技能自己拼 libreoffice 命令。
2026-10-21 17:22:07 +08:00

38 lines
1.3 KiB
Bash
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
set -e
# 确保存在可用的中文字体(watermark 中文水印需要):Pillow 能读 wqy/Noto 任意字体,
# 但 NotoSansCJK ttc 的默认字型(索引 0)是 JP,中文水印会出日式字形,
# 因此就绪判定优先文泉驿(镜像已预装,缺失时 apt 兑底),Noto 仅作告警兑底。
# 命中即幂等退出;依赖缓存由 Skill Manager 依据本脚本内容哈希管理。
has_wqy() {
for f in /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc \
/usr/share/fonts/truetype/wqy/wqy-microhei.ttc; do
[ -f "$f" ] && return 0
done
return 1
}
if has_wqy; then
echo "文泉驿字体已存在"
exit 0
fi
if [ "$(id -u)" -eq 0 ]; then
echo "未找到中文字体,安装 fonts-wqy-zenhei..."
# best-effort:apt 失败不直接报错,交给下面的就绪判定兜底
apt-get update -y -qq || true
apt-get install -y -qq fonts-wqy-zenhei || true
fi
if has_wqy; then
echo "中文字体就绪"
elif [ -f /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc ]; then
# Noto 兜底:中文能显示,只是默认字型偏日式;不算失败
echo "警告:仅有 Noto CJK 字体(中文水印将使用其默认 JP 字型),建议安装文泉驿"
else
echo "错误:无中文字体可用(非 root 且系统未装文泉驿/Noto)" >&2
exit 1
fi