Files
plane-agentd/tools/win10/win10-ps.sh
T
jj.wang 27ea9119a5 LXC deployment: live config for agentd-01, oregon rollback config, win10 helpers and board protocol in the repo
- config/agentd.yaml is now the agentd-01 live config (state /var/lib/plane-agentd, logs /var/log/plane-agentd);
  config/agentd.oregon.yaml keeps the oregon dispatcher settings for rollback (cron/agentd-tick.sh uses it).
- cron/agentd-tick-lxc.sh: the LXC cron entry.
- tools/win10/: win10-ps.sh / win10-put.sh (vault client dir via AGENT_ACCESS_HOME); relative helpers_dir
  resolves against the repo, default tools/win10.
- config/protocols/gwent-board-protocol.md: copy of gwent/design/board-protocol.md used in prompts.
- agentd.log_dir (default state_dir).
- smoke --watch: create the item and wait for the scheduled dispatcher instead of ticking locally.
2026-10-21 11:56:15 +00:00

19 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run a PowerShell script (passed as $1 text, or a file with -f) on win10 through server-access,
# encoded as -EncodedCommand so quoting never crosses the relay. Output is UTF-8; progress noise off.
# AGENT_ACCESS_HOME = directory of the vault client (default ~/.local/share/server-access-client);
# AGENT_ACCESS_CONFIG = identity URL/file.
set -euo pipefail
CLIENT="${AGENT_ACCESS_HOME:-$HOME/.local/share/server-access-client}/agent-access.py"
CFG="${AGENT_ACCESS_CONFIG:-https://nas.tail9531b.ts.net:8443/identity/agent.json}"
TIMEOUT="${WIN10_TIMEOUT:-120}"
if [ "${1:-}" = "-f" ]; then SCRIPT="$(cat "$2")"; else SCRIPT="$1"; fi
SCRIPT="[Console]::OutputEncoding=[Text.Encoding]::UTF8
\$ErrorActionPreference='Continue'
\$ProgressPreference='SilentlyContinue'
$SCRIPT"
B64="$(printf '%s' "$SCRIPT" | iconv -f UTF-8 -t UTF-16LE | base64 -w0)"
if [ "${#B64}" -gt 7600 ]; then echo "encoded command too long (${#B64} > 7600)" >&2; exit 2; fi
exec python3 -I "$CLIENT" --config "$CFG" run --target win10 --timeout "$TIMEOUT" -- \
powershell.exe -NoProfile -NonInteractive -EncodedCommand "$B64" 2> >(grep -v -E '^#< CLIXML|^<Objs|正在准备首次使用模块' >&2)