#!/usr/bin/env bash
# Enable NDI discovery on first install, including offline image builds.
# Upgrades keep whatever the administrator chose since.
configure_ndi_discovery() {
    if ! systemctl enable avahi-daemon.service; then
        printf '%s\n' 'BigNetScreen: Avahi could not be enabled; NDI discovery needs avahi-daemon.service.'
        return 0
    fi
    if [[ -d /run/systemd/system ]]; then
        systemctl start avahi-daemon.service ||
            printf '%s\n' 'BigNetScreen: Avahi could not be started; check avahi-daemon.service.'
    fi
}

post_install() {
    configure_ndi_discovery
}
