#!/bin/bash
#
# Rootfs mktree backend for use in throwaway build containers.
# Installs RPM into / and runs the test-suite against the same.
#
# PWD must be host-mounted for OverlayFS mounts to work.
# The / filesystem should be read-only to prevent parallel tests from altering
# it (online changes to an underlying filesystem are disallowed in OverlayFS).

set -e

CMD=$1; shift
case $CMD in
    build)
        source ./mktree.common
        make_install /
    ;;
    check)
        ./rpmtests "$@"
    ;;
    *)
        echo "Unsupported command." >&2
        exit 1
    ;;
esac
