-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathpatch.sh
executable file
·78 lines (71 loc) · 2.54 KB
/
patch.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -euo pipefail
err() {
>&2 echo "$@"
}
usage() {
err "usage: $1 ThePathOfYourOpenRestySrcDirectory"
exit 1
}
failed_to_cd() {
err "failed to cd $1"
exit 1
}
apply_patch() {
patch_dir="$1"
root="$2"
repo="$3"
ver="$4"
dir="$root/bundle/$repo-$ver"
pushd "$dir" || failed_to_cd "$dir"
for patch in "$patch_dir/$repo"-*.patch; do
echo "Start to patch $patch to $dir..."
patch -p0 --verbose < "$patch"
done
popd
}
if [[ $# != 1 ]]; then
usage "$0"
fi
root="$1"
if [[ "$root" == *openresty-1.19.3.* ]]; then
patch_dir="$PWD/1.19.3"
apply_patch "$patch_dir" "$root" "nginx" "1.19.3"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.21"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.19"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.9"
elif [[ "$root" == *openresty-1.19.9.* ]]; then
patch_dir="$PWD/1.19.9"
apply_patch "$patch_dir" "$root" "nginx" "1.19.9"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.22"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.20"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.10"
apply_patch "$patch_dir" "$root" "LuaJIT-2.1" "20210510"
elif [[ "$root" == *openresty-1.21.4.1 ]]; then
patch_dir="$PWD/1.21.4.1"
apply_patch "$patch_dir" "$root" "nginx" "1.21.4"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.23"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.21"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.11"
elif [[ "$root" == *openresty-1.21.4.* ]]; then
patch_dir="$PWD/1.21.4"
apply_patch "$patch_dir" "$root" "nginx" "1.21.4"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.27"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.25"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.13"
elif [[ "$root" == *openresty-1.25.3.* ]]; then
patch_dir="$PWD/1.25.3.1"
apply_patch "$patch_dir" "$root" "nginx" "1.25.3"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.28"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.26"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.14"
elif [[ "$root" == *openresty-1.27.1.* ]]; then
patch_dir="$PWD/1.27.1.1"
apply_patch "$patch_dir" "$root" "nginx" "1.27.1"
apply_patch "$patch_dir" "$root" "lua-resty-core" "0.1.30"
apply_patch "$patch_dir" "$root" "ngx_lua" "0.10.27"
apply_patch "$patch_dir" "$root" "ngx_stream_lua" "0.0.15"
else
err "can't detect OpenResty version"
exit 1
fi