Files

27 lines
928 B
Bash
Raw Permalink 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.
#!/usr/bin/env bash
# 把本项目的 DFHack 脚本部署进游戏目录,并写入开机自动运行的 init 片段。
# scripts/deploy-dfhack.sh /mnt/c/Users/23518/DwarfFortress/df_53_16_win
set -euo pipefail
DF_DIR="${1:?用法: deploy-dfhack.sh <DF 目录>}"
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SRC="$HERE/scripts/dfhack/dfannals"
[[ -d "$DF_DIR" ]] || { echo "游戏目录不存在: $DF_DIR" >&2; exit 1; }
[[ -d "$DF_DIR/hack" ]] || { echo "该目录里没有 hack/,DFHack 未安装?" >&2; exit 1; }
DEST="$DF_DIR/hack/scripts/dfannals"
mkdir -p "$DEST"
cp -v "$SRC"/*.lua "$DEST/"
INIT_DIR="$DF_DIR/dfhack-config/init"
mkdir -p "$INIT_DIR"
cat > "$INIT_DIR/dfannals.init" <<'EOF'
# 由 df-annals 项目部署。默认只跑观测脚本;需要全自动时改成 dfannals/drive。
dfannals/observe
EOF
echo "已部署到:$DEST"
echo "init 片段:$INIT_DIR/dfannals.init"
ls -1 "$DEST"