#!/bin/sh +e

# run-parts - concept taken from Debian

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

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

for f in "$1"/* ; do
	[ -d "$f" ] && continue
	# Don't run [KS]??foo.{rpmsave,rpmorig,rpmnew,rpmold} scripts
	[ "${f%.rpmsave}" != "$f" ] && continue
	[ "${f%.rpmorig}" != "$f" ] && continue
	[ "${f%.rpmnew}" != "$f" ] && continue
	[ "${f%.rpmold}" != "$f" ] && continue

	if [ -x "$f" ]; then
		"$f"
	fi
done

exit 0
