#!/bin/sh
# host-side: deploy + rebuild the DF-3173 pack on the CURRENT guest
# (no reset -- use for fix-validation runs on a patched kernel)
set -e
ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
Q="$ROOT/dfbsd-qemu"
P="$ROOT/findings/poc/DF-3173"

"$Q/vm.sh" run_root 'mkdir -p /root/poc/df3173'
for f in df3173_race.c fake_daemon3173.c pending_stat.c autofs_ioctl.h Makefile build.sh run.sh runB.sh debug1.sh; do
	scp -q -F "$Q/config" "$P/$f" dfbsd:/tmp/$f
done
"$Q/vm.sh" run_root 'for f in df3173_race.c fake_daemon3173.c pending_stat.c autofs_ioctl.h Makefile build.sh run.sh runB.sh debug1.sh; do cp /tmp/$f /root/poc/df3173/; done && sh /root/poc/df3173/build.sh' | tail -2
