#!/bin/sh

cec_device="${CEC_DEVICE:-/dev/cec0}"
status=0

if [ -c "$cec_device" ]; then
    /usr/bin/cec-ctl --device "$cec_device" --to 0 --standby >/dev/null || status=$?
else
    echo "cec-standby: CEC device not found: $cec_device" >&2
    status=1
fi

/usr/bin/systemctl stop signage.service || status=$?

exit "$status"
