#!/usr/bin/sh

# The packaged channels.conf contains only whitespace; VDR is not useful
# before a real channel list exists, so refuse to start (exit 2 matches
# RestartPreventExitStatus in vdr.service) until one has been created.

cfg=/etc/vdr/channels.conf
if ! grep -q '[^[:space:]]' "$cfg" 2>/dev/null ; then
    echo "$cfg is empty, use \"scandvb -o vdr\" from the dvb-apps package to create one." >&2
    exit 2
else
    chown vdr:video "$cfg" && chmod 644 "$cfg"
fi
