/usr/bin/dpsyco-patch is in dpsyco-lib 1.0.36.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #!/bin/sh
# DocumentId:	$Id: dpsyco-patch 2410 2007-03-21 12:17:27Z ola $
# Author:	$Author: ola $
#		Ola Lundqvist <opal@debian.org>
# Date:		$Date: 2007-03-21 13:17:27 +0100 (Wed, 21 Mar 2007) $
# Arguments:	$1	Source
#		$2	Destination
# Summary:
#	Patches a file structure.
#
# Copyright (C) 2001-2004 Ola Lundqvist <opal@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
SOURCE="$1"
DEST="$2"
SKELSRC="$3"
FINDOPT="$4"
#LISTPRE="$5"
if [ -z "$LISTPRE" ] ; then
    LISTPRE=$(echo "$SOURCE" | sed -e "s|/|_|g;")"-"
fi
if [ ! -d "$SOURCE" ] ; then
    echo "Source $SOURCE is not a directory, exiting."
    exit 0
fi
if [ ! -d "$DEST" ] ; then
    echo "Destination $DEST is not a directory, exiting."
    exit 0
fi
DESTAPP=$(echo "$DEST" | sed -e "s|^//*||;")
CDIR=/var/lib/dpsyco-patch/$DESTAPP
mkdir -p $CDIR
OLDLISTF=$CDIR/${LISTPRE}patch.list
LISTF=$CDIR/${LISTPRE}tmppatch.list
NOWAPPLIEDF=$CDIR/${LISTPRE}tmppatch.nowapplied
BDIR=$CDIR/${LISTPRE}patches
touch $OLDLISTF
find $SOURCE -type f $FINDOPT | sed -e "s|^$SOURCE||;" | sed -e "s|^/||;" | grep -v "^$" | sort > $LISTF
SEPREM="< "
SEPADD="> "
# Compare the two patch-skel files and see what files that have been removed.
diff $OLDLISTF $LISTF | grep "$SEPREM" | sed -e "s|^$SEPREM||;" | cut -d '@' -f 1 | {
    while read FILE ; do
	# Reverse apply the removed patches.
	if [ -n "$SKELSRC" -a -e "$SKELSRC/$F" ] ; then
	    # No idea to reverse apply things that exist in skel...
	    true
	else
	    dpsyco-applypatch "$BDIR/$FILE" $DEST "-R"
	fi
    done
}
if [ -e $NOWAPPLIEDF ] ; then
    rm -f $NOWAPPLIEDF
fi
touch $NOWAPPLIEDF
# Compare the two patch-skel files and see what files that have been added.
diff $OLDLISTF $LISTF | grep "$SEPADD" | sed -e "s|^$SEPADD||;" | cut -d '@' -f 1 | {
    while read FILE ; do
	dpsyco-applypatch "$SOURCE/$FILE" $DEST "-N"
	echo $FILE >> $NOWAPPLIEDF
    done
}
# Compare the already applied files with the new ones.
diff $NOWAPPLIEDF $LISTF | grep "$SEPADD" | sed -e "s|^$SEPADD||;" | cut -d '@' -f 1 | {
    while read FILE ; do
	FILES=$(grep "^+++ " "$SOURCE/$FILE" | sed -e "s|^+++ ||" | sed "s|[[:space:]].*||")
	EXISTINSKEL=
	for F in $FILES ; do
	    if [ -e $SKELSRC/$F ] ; then
		EXISTINSKEL=yes
	    fi
	done
	if [ -n "$EXISTINSKEL" ] ; then
	    dpsyco-applypatch "$SOURCE/$FILE" $DEST "-N"
	fi
    done
}
rsync -rlptD -I --delete "$SOURCE/" "$BDIR"
# Store the new skel as the old one.
mv $LISTF $OLDLISTF
rm -f $NOWAPPLIEDF
 |