#!/usr/bin/bash
# run-parts - concept taken from Debian

set +xe

if [ $# -lt 1 ]; then
	echo "Usage: risotto-run-parts <dir>"
	exit 1
fi

if [ ! -d $1 ]; then
	echo "Not a directory: $1"
	exit 1
fi

# Ignore *~ and *, scripts
for i in $(LC_ALL=C; echo ${1%/}/*[^~,]) ; do
	[ -d $i ] && continue
	[ ! -x $i ] && continue
	echo "execute $i"
	$i 2>&1
done

exit 0