#!/bin/bash

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2010 Adam Boeglin (adamrb@gmail.com)

. /etc/profile

oe_setup_addon service.multimedia.boblightd

chmod a+x $ADDON_DIR/bin/*

cp $ADDON_DIR/config/*.sample $ADDON_HOME
if [ ! -f $ADDON_HOME/boblight.conf ] ; then
  cp $ADDON_DIR/config/boblight.conf $ADDON_HOME/boblight.conf
fi

if [ -x $ADDON_DIR/bin/boblight-X11 -a -e $ADDON_HOME/boblight.X11 ] ; then
  boblight-X11 -f >/dev/null 2>&1
fi

exec boblightd -c $ADDON_HOME/boblight.conf > $ADDON_LOG_FILE 2>&1
