Merge "res_rtp_asterisk.c: Fix rtp source address learning for broken clients"
[asterisk/asterisk.git] / third-party / pjproject / apply_patches
1 #!/bin/sh
2
3 if [ "$1" = "-q" ] ; then
4         quiet=1
5         shift
6 fi
7
8 PATCH=${PATCH:-patch}
9
10 patchdir=${1:?You must supply a patches directory}
11 sourcedir=${2?:You must supply a source directory}
12
13 if [ ! -d "$patchdir" ] ; then
14         echo "$patchdir is not a directory" >&2
15         exit 1
16 fi
17
18 if [ ! -d "$sourcedir" ] ; then
19         echo "$sourcedir is not a directory"  >&2
20         exit 1
21 fi
22
23 if [ ! "$(ls -A $patchdir/*.patch 2>/dev/null)" ] ; then
24         echo "No patches in $patchdir"  >&2
25         exit 0
26 fi
27
28 for patchfile in "$patchdir"/*.patch ; do
29         [ -z $quiet ] && echo "Applying patch $(basename $patchfile)"
30         ${PATCH} -d "$sourcedir" -p1 -s -i "$patchfile" || exit 1
31 done
32
33 exit 0
34