/usr/share/dpatch/dpatch.lib.sh is in dpatch 2.0.38.
This file is owned by root:root, with mode 0o644.
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 | ## dpatch.lib.shpp -*- shell-script -*-
set -e
dpatch_lib_patch ()
{
if test "x${DPATCH_LIB_NO_DEFAULT}" = "x"; then
patch -p1 $*
if test -x /usr/bin/lsdiff; then
now=$(date +"%Y%m%d%H%M.%S")
cwd=$(pwd)
if ! test -z "${DPATCH_WORKDIR}"; then
cd "${DPATCH_WORKDIR}"
fi
lsdiff --strip 1 -h "${DPATCH_SOURCE}" | xargs touch -t "$now"
cd "${cwd}"
fi
return
fi
dpatch_patch $*
}
dpatch_lib_unpatch ()
{
if test "x${DPATCH_LIB_NO_DEFAULT}" = "x"; then
patch -p1 -R $*
return
fi
dpatch_unpatch $*
}
case $0 in
*/dpatch-run)
patch=$1
action=$2
workdir=$3
;;
*)
patch=$0
action=$1
workdir=$2
;;
esac
if test "x$action" = "x"; then
echo "$(basename ${patch}): script expects -patch|-unpatch as argument" >&2
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--g0 -f --no-backup-if-mismatch} ${workdir:+-d ${workdir}}"
DPATCH_SOURCE="${patch}"
DPATCH_WORKDIR="${workdir}"
case "${action}" in
-patch) dpatch_lib_patch ${patch_opts} < ${patch};;
-unpatch) dpatch_lib_unpatch ${patch_opts} < ${patch};;
*)
echo "$(basename ${patch}): script expects -patch|-unpatch as argument" >&2
exit 1;;
esac
exit 0
|