#!/bin/sh set -eu . tools/lib.sh D="$(mkdtemp)" trap 'rm -rf "$D"' EXIT make -s DESTDIR="$D" install PATH="$D/usr/bin:$PATH" NODE_PATH="$D/usr/lib/node:$NODE_PATH" { printf 'Assert that the papo(3js) library is installed correctly...' node -e 'require("papo");' printf ' OK.\n' printf 'Assert that the papo(1) command is installed correctly...' papo -V | grep -q '^papo ' printf ' OK.\n' make -s DESTDIR="$D" uninstall printf 'Assert that the papo(1) command is installed correctly...' if [ "$(find "$D" -not -type d | wc -l)" != 0 ]; then printf ' ERR.\n' cat <<-EOF Leftover files not removed by "make uninstall": $(find "$D" -not -type d) EOF exit 1 fi printf ' OK.\n' } >&2