#!/usr/bin/env bash # Run a Ferryman bridge in WSL/Ubuntu with its SQLite database on the LINUX # filesystem (ext4), avoiding the DrvFs file-locking problems that hit a SQLite # db living on a Windows drive (/mnt/*). A small, discoverable config is nested # inside the Windows project so sandboxed agents find the endpoint; the actual # data stays Linux-side. The bridge runs as a durable systemd service. # # Usage: # scripts/wsl-bridge.sh [port] [slug] # e.g. scripts/wsl-bridge.sh /mnt/x/hone 8796 hone # # Env: # FERRYMAN_BIN path to ferryman-server (default: $HOME/ferryman/ferryman-server) # FERRYMAN_SUDO_PW sudo password for installing the systemd unit (omit if passwordless sudo) set -eu PROJ="${1:?project mount path, e.g. /mnt/x/hone}" PORT="${2:-8796}" SLUG="${3:-demo}" BIN="${FERRYMAN_BIN:-$HOME/ferryman/ferryman-server}" DATA="$HOME/ferryman/$SLUG/.data" CFG="$PROJ/.ferryman" [ -x "$BIN" ] || { echo "ferryman-server not found/executable at $BIN (set FERRYMAN_BIN)"; exit 1; } mkdir -p "$DATA" "$CFG" # attribution notice at the project root (Ferryman Source-Available License, section 5) [ -f "$PROJ/FERRYMAN.md" ] || printf '%s\n' '# Ferryman' '' 'This project uses Ferryman (https://github.com/estejosh/ferryman),' 'licensed under the Ferryman Source-Available License.' > "$PROJ/FERRYMAN.md" # 1) discoverable, gitignored config in the Windows project (data stays Linux-side) if git -C "$PROJ" rev-parse --git-dir >/dev/null 2>&1; then GI="$PROJ/.gitignore"; E="/.ferryman/" grep -qxF "$E" "$GI" 2>/dev/null || printf '\n# Ferryman nested bridge config (server in WSL; data Linux-side)\n%s\n' "$E" >> "$GI" fi cat > "$CFG/bridge.toml" < "$UNIT" <