27ea9119a5
- 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.
27 lines
1.3 KiB
Bash
Executable File
27 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Upload a local text/binary file to win10: gzip+base64, appended in chunks through the relay,
|
|
# then decoded remotely and verified by SHA-256.
|
|
# usage: win10-put.sh <local-file> <remote-windows-path>
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
LOCAL="$1"; REMOTE="$2"
|
|
TMP="$REMOTE.b64"
|
|
SHA="$(sha256sum "$LOCAL" | cut -d' ' -f1)"
|
|
B64="$(gzip -9c "$LOCAL" | base64 -w0)"
|
|
CHUNK=2400
|
|
"$HERE/win10-ps.sh" "New-Item -ItemType Directory -Force -Path (Split-Path -Parent '$REMOTE') | Out-Null; Set-Content -Path '$TMP' -Value '' -NoNewline -Encoding Ascii; 'reset'" >/dev/null
|
|
TOTAL=$(( (${#B64} + CHUNK - 1) / CHUNK ))
|
|
for ((i=0; i<${#B64}; i+=CHUNK)); do
|
|
PART="${B64:i:CHUNK}"
|
|
n=$(( i / CHUNK + 1 ))
|
|
"$HERE/win10-ps.sh" "Add-Content -Path '$TMP' -Value '$PART' -NoNewline -Encoding Ascii; 'chunk $n/$TOTAL'" | tail -1
|
|
done
|
|
"$HERE/win10-ps.sh" "\$b=[Convert]::FromBase64String((Get-Content -Raw -Encoding Ascii '$TMP'))
|
|
\$ms=New-Object IO.MemoryStream(,\$b)
|
|
\$gz=New-Object IO.Compression.GZipStream(\$ms,[IO.Compression.CompressionMode]::Decompress)
|
|
\$out=New-Object IO.MemoryStream; \$gz.CopyTo(\$out)
|
|
[IO.File]::WriteAllBytes('$REMOTE',\$out.ToArray())
|
|
Remove-Item '$TMP'
|
|
'remote sha256 ' + (Get-FileHash '$REMOTE' -Algorithm SHA256).Hash.ToLower()
|
|
'expected $SHA'"
|