#! /bin/sh
set -e

dir=$(pwd)/debian/tests
. $dir/textutils.sh

frame "Test for features/Enable-running-daemon-in-foreground.patch "

echo "============ enable pam_group for cron ====================="
echo "auth       optional   pam_group.so" >> /etc/pam.d/cron

echo "================= adding user 'dummy' ====================="
getent passwd dummy || adduser --disabled-password --gecos "" dummy
touch /var/mail/dummy && chown dummy /var/mail/dummy

echo "===== group 'plugdev' for user dummy, with group.conf ====="
grep -q dummy /etc/security/group.conf || echo "*;*;dummy;Al0000-2400;plugdev" >> /etc/security/group.conf

echo "======== create a crontab for user dummy =================="

if su dummy -c "cron -e" 2>&1 | grep -q "unrecognized option"; then
    abort "-e unrecognised option"
fi

echo "======== ok, new options are recognized =================="

exit 0
