#!/bin/sh diff_options=-up if [ -z "$1" -o -z "$2" ]; then echo "usage: ${0##*/} " >&2 exit 1 fi if [ -n "$3" ]; then : ${SOURCEDIR:=`rpm --eval %_sourcedir`} >"$SOURCEDIR/$1-$3.patch" fi find "$1" -mindepth 1 \( -name "*$2" -o -name ".*$2" \) -print | LC_COLLATE=C sort -u | while read -r fin; do fou=`echo "$fin" |sed -e "s/$2\$//"` [ -r "$fin" ] || fin="/dev/null" [ -r "$fou" ] || fou="/dev/null" if [ -n "$3" ]; then diff $diff_options -- "$fin" "$fou" | tee -a "$SOURCEDIR/$1-$3.patch" else diff $diff_options -- "$fin" "$fou" fi done