]>
git.ipfire.org Git - people/stevee/pakfire.git/blob - tools/patch
4d4c2ae5776b3562b069358c395602474d267f40
2 # Script that automatically applies patches.
10 paths
="${paths} ${1#--search-path=}"
13 patches
="${patches} ${1}"
19 if [ -n "${patches}" ]; then
20 echo "Applying patches..."
23 # Apply all patches given on command line.
24 for patch in ${patches}; do
29 for path
in ${paths}; do
30 if [ -e "${path}/${patch}" ]; then
31 patch="${path}/${patch}"
38 # Check if patch file does exist.
39 if ! [ -e "${patch}" ]; then
40 echo >&2 " ERROR: Patch file does not exist: ${patch}"
44 # Options applied to patch command.
47 # Get right -p1 option.
49 *.
patch[0-9]|
*.
patch[0-9]R
)
51 # Get patch level from file name.
52 while [ ${#_patch} -gt 0 ]; do
53 last_pos
=$
(( ${#_patch} - 1 ))
54 last_char
=${_patch:${last_pos}}
55 _patch
=${_patch:0:${last_pos}}
57 case "${last_char}" in
59 options
="${options} -p${last_char}"
63 options
="${options} -R"
70 options
="${options} -p1"
73 echo >&2 " WARNING: Ignoring unknown file: ${patch}"
78 echo " Applying ${patch} (${options})..."
79 patch ${options} -i ${patch} ||
exit $?