#!/bin/sh
set -e

EOLE_DEBSUMS=/usr/share/eole/debsums/eole-debsums.sh
LXC_ROOTDIR='/opt/lxc'

# Run script in containers if any
if [ -d "${LXC_ROOTDIR}" ]
then
    for lxc in $(/bin/ls -1 ${LXC_ROOTDIR})
    do
	if [ -d "${LXC_ROOTDIR}/${filename}" ] && type CreoleRun > /dev/null 2>&1
	then
	    # Do not forget to redirect input&output to get in background
	    CreoleRun "${EOLE_DEBSUMS} > /dev/null 2> /dev/null < /dev/null &" $lxc
	fi
    done
fi

if [ ! -x "${EOLE_DEBSUMS}" ]
then
    echo "${EOLE_DEBSUMS} is not executable" 1>&2
else
    sh ${EOLE_DEBSUMS} > /dev/null 2>&1
fi
