#!/bin/sh
# DF-2866 - build the pgtmark KLD on the guest (stock kernel, no rebuild).
set -e
cd "$(dirname "$0")"
CFG=../../../dfbsd-qemu/config
SSH="ssh -F $CFG -o ConnectTimeout=8 -o BatchMode=yes dfbsd"

$SSH 'mkdir -p /root/pgtmark'
cat pgtmark.c | $SSH 'cat > /root/pgtmark/pgtmark.c'
$SSH 'cd /root/pgtmark && printf "KMOD=pgtmark\nSRCS=pgtmark.c\n\n.include <bsd.kmod.mk>\n" > Makefile && make' 2>&1
$SSH 'ls -l /root/pgtmark/pgtmark.ko'
