| 1 | #!/bin/sh |
| 2 | |
| 3 | SRC_DIR="${1}" |
| 4 | PATCH_DIR="${2}" |
| 5 | |
| 6 | cd "${SRC_DIR}" || exit 1 |
| 7 | |
| 8 | for patch_file in "${PATCH_DIR}"/*; do |
| 9 | patch -p1 --forward -i "${patch_file}" |
| 10 | ret="${?}" |
| 11 | |
| 12 | # We want to ignore patches that are already applied instead of |
| 13 | # failing the patching process, and patch returns 1 for a patch that |
| 14 | # is already applied, and higher numbers for other errors. |
| 15 | if [ "${ret}" -gt 1 ] ; then |
| 16 | exit 1 |
| 17 | fi |
| 18 | done |