#!/bin/sh

set -e
for cronfile in skel/etc/cron.d/*; do
    echo "checking $cronfile..."
    if ! echo "$cronfile" | grep -q "."; then
        echo "$cronfile: crontabs may not have an extension"
        exit 1
    fi
    if ! [ $(tail -c1 "$cronfile" | wc -l) -gt 0 ]; then
        echo "$cronfile: crontabs must end with a newline"
        exit 1
    fi
done