#!/bin/sh -e
if ! test -d package || ! test -d package/debian
then
	echo "You are not in the right directory." 1>&2
	exit 100
fi
if ! command -v pax 2>/dev/null
then
	# https://pubs.opengroup.org/onlinepubs/9799919799/utilities/pax.html
	echo "Non-POSIX operating system: pax not found." 1>&2
	exit 100
fi

export CDPATH=

# Create and populate the debian directory.
install -d -m 0755 debian
( cd package/debian && ( 2>/dev/null pax -w -r -l -u -- * ../../debian/ || true ) )
