#!/bin/sh
set -e

test -z "$CRUFT_ROOT" || exit 0

set -u

if test -e "/var/mail/root"
then
	echo "/var/mail/root"
fi

if test -e "/var/spool/cron/crontabs/root"
then
	echo "/var/spool/cron/crontabs/root"
fi

awk -F: '{ if ( 1000 <= $3 && $3 < 30000 ) print $1 " " $6}' /etc/passwd | while read -r user home
do
	if test -d "$home"
	then
		echo "$home"
	fi

	if test -e "/var/mail/$user"
	then
		echo "/var/mail/$user"
	fi

	if test -e "/var/spool/cron/crontabs/$user"
	then
		echo "/var/spool/cron/crontabs/$user"
	fi
done

exit 0
