#!/usr/bin/env bash # Real SSH/rsync + Docker on an isolated loopback endpoint and a disposable root. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." repository="$PWD" node_binary=$(command -v node) check=$(mktemp -d "$PWD/.tools/phase7-check.XXXXXX") printf '%s\n' "$check" > .tools/phase7-check-path mkdir -p "$check/evidence" "$check/ssh" "$check/bin" "$check/host" "$check/source" git ls-files --cached --others --exclude-standard -z > "$check/files.list" tar --null -T "$check/files.list" -cf "$check/source.tar" tar --no-same-owner -xf "$check/source.tar" -C "$check/source" git -C "$check/source" init -q git -C "$check/source" add -A git -C "$check/source" -c user.name='Phase 7 verification' -c user.email='phase7@localhost' commit -qm 'Temporary integration snapshot' git clone -q "$check/source" "$check/clone" clone="$check/clone" mkdir "$clone/node_modules" cp -a "$repository/node_modules/yaml" "$repository/node_modules/smol-toml" "$clone/node_modules/" mkdir -p "$clone/.tools/packwiz" cp "$repository/.tools/packwiz/packwiz" "$clone/.tools/packwiz/packwiz" cp "$repository/.tools/docker-compose" "$clone/.tools/docker-compose" (cd "$clone" && ./mcpack build --release) > "$check/evidence/build-first.log" 2>&1 sed -i 's/^version = ".*"$/version = "0.0.5"/' "$clone/pack/pack.toml" printf 'server-override-phase7-v2\n' > "$clone/server/config/spike-marker.txt" (cd "$clone/pack" && ../.tools/packwiz/packwiz refresh) git -C "$clone" add pack server/config git -C "$clone" -c user.name='Phase 7 verification' -c user.email='phase7@localhost' commit -qm 'Second test release' (cd "$clone" && ./mcpack build --release) > "$check/evidence/build-second.log" 2>&1 ssh-keygen -q -t ed25519 -N '' -f "$check/ssh/host-key" ssh-keygen -q -t ed25519 -N '' -f "$check/ssh/client-key" cp "$check/ssh/client-key.pub" "$check/ssh/authorized_keys" cat > "$check/ssh/sshd_config" < "$check/ssh/known_hosts" cut -d ' ' -f 1-2 "$check/ssh/host-key.pub" >> "$check/ssh/known_hosts" cat > "$check/ssh/client_config" < "$check/bin/ssh" <