This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
nginx-build.sh
executable file
·82 lines (69 loc) · 2.1 KB
/
nginx-build.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
79
80
81
82
#!/bin/bash
# Create directories if not already present
rpmdev-setuptree
# Obtain a location for the patches, either from /app (Docker)
# or cloned from GitHub (if run stand-alone).
if [ -d '/app' ]; then
patch_dir='/app'
else
patch_dir=$(mktemp)
git clone https://github.com/jcu-eresearch/nginx-custom-build.git "$patch_dir"
fi
cp "$patch_dir/nginx-centos-6.repo" /etc/yum.repos.d/
cp "$patch_dir/nginx-eresearch.patch" ~/rpmbuild/SPECS/
cp "$patch_dir/nginx-xslt-html-parser.patch" ~/rpmbuild/SOURCES/
# Remove temp directory if not Docker
if ! [ -d '/app' ]; then
rm -rf "$patch_dir"
fi
# Download specific nginx version or just the latest version
if [ "$_NGINX_VERSION" ]; then
yumdownloader --source "nginx-$_NGINX_VERSION"
else
yumdownloader --source nginx
fi
if ! [ $? -eq 0 ]; then
echo "Couldn't download nginx source RPM. Aborting build."
exit 1
fi
sudo rpm -ihv nginx*.src.rpm
#Get various add-on modules for nginx
#XXX git clone -b [tag] isn't supported on git 1.7 (RHEL 6)
pushd ~/rpmbuild/SOURCES
#Headers More module
git clone https://github.com/openresty/headers-more-nginx-module
pushd headers-more-nginx-module
git checkout v0.30rc1
popd
#Fancy Index module
git clone https://github.com/aperezdc/ngx-fancyindex.git
pushd ngx-fancyindex
git checkout ba8b4ec
popd
#AJP module
git clone https://github.com/yaoweibin/nginx_ajp_module.git
pushd nginx_ajp_module
git checkout bf6cd93
popd
#LDAP authentication module
git clone https://github.com/kvspb/nginx-auth-ldap.git
pushd nginx-auth-ldap
git checkout d0f2f82
popd
#Shibboleth module
git clone https://github.com/nginx-shib/nginx-http-shibboleth.git
pushd nginx-http-shibboleth
git checkout development
popd
popd
#Prep and patch the nginx specfile for the RPMs
pushd ~/rpmbuild/SPECS
patch -p1 < nginx-eresearch.patch
spectool -g -R nginx.spec
yum-builddep -y nginx.spec
rpmbuild -ba nginx.spec
if ! [ $? -eq 0 ]; then
echo "RPM build failed. See the output above to establish why."
exit 1
fi
popd