#!/bin/sh
. debian/scripts/vars
. debian/scripts/lib
mkdir -p $STAMP_DIR/upstream/fixpatch upstream
for f in `find debian/fixpatch -type f 2> /dev/null |sort`;do
	bf=$(basename $f)
	stampfile=$STAMP_DIR/upstream/fixpatch/$bf
	if [ ! -e $stampfile ];then
		[ -r debian/fixpatch/.$bf ] && sh debian/patches/.$bf && continue
		START $bf
		if file2cat $f | (cd upstream;patch -p1 ) > $stampfile.log;then
			OK
			touch $stampfile
		else
			FAILED
			exit 1
		fi
	else
		ALREADY_DONE $bf
	fi
done
