forked from open-power-ref-design/accelerated-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch_source.sh
executable file
·54 lines (46 loc) · 976 Bytes
/
patch_source.sh
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
#!/bin/bash
#
# Prepare and apply all patches for:
#
# 1) general fixes (e.g. backports) that aren't present in the release
# we're building
#
# 2) updates specific to _building_ on POWER (but not fixes specific
# to packaging; those belong in the packaging steps
#
# Exit 0 on success; 1 on failure
#
if [ -z "$1" -o ! -z "$2" ]
then
echo "Usage: $(basename $0) <source-tree-base>"
exit 1
fi
SOURCE="$1"
OPWD=$(pwd)
if [ ! -d "$1" ]
then
echo "ERROR: $SOURCE is not a directory"
exit 1
fi
if [ -x "./prepare_patches.sh" ]
then
echo "Preparing patches"
if ! ./prepare_patches.sh
then
echo "ERROR: Failed to prepare patches"
exit 1
fi
fi
cd "${SOURCE}"
ls -1 ../patches/*patch 2>/dev/null | sort | while read pfile
do
echo "Applying patch: ${pfile}"
if ! patch -p1 < "${pfile}"
then
echo "ERROR: Patch application failed ${pfile}"
cd "$OPWD"
exit 1
fi
done
cd "$OPWD"
exit 0