#!/bin/sh

set -e

# Ensure that the manpages are installed and accessible
for section in $(seq 8); do
    if ! man "$section" intro > /dev/null 2>&1; then
        exit 1
    fi
done

# Ensure that manpages-dev are not installed,
# test two randomly picked examples.
if [ -f /usr/share/man/man2/getuid.2.gz ]; then
    exit 1
fi
if [ -f /usr/share/man/man3/dysize.3.gz ]; then
    exit 1
fi

# Test two randomly picked links to other manpages do not exist.
if [ -L /usr/share/man/man2/kexec_file_load.2.gz ]; then
    exit 1
fi
if [ -L /usr/share/man/man3/tcflow.3.gz ]; then
    exit 1
fi

exit 0
