-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.sh
executable file
·70 lines (51 loc) · 1.11 KB
/
install.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
#!/usr/bin/env bash
#
# Create build folder if not exists.
#
if [ ! -f "build" ]; then
mkdir build
fi
#
# Set and check version.
#
NGINX_VERSION=$1
if [ -z "${NGINX_VERSION// }" ]; then
NGINX_VERSION="1.12.0"
fi
function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; }
if version_gt "1.11.5" $NGINX_VERSION; then
echo "Error: min nginx version is 1.11.5." >&2
exit 1
fi
#
# Download sources.
#
if [ ! -f "build/nginx-$NGINX_VERSION.tar.gz" ]; then
wget "https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz" -O "build/nginx-$NGINX_VERSION.tar.gz"
fi
#
# Extract sources.
#
cd build
if [ ! -d "nginx-$NGINX_VERSION" ]; then
tar -xvzf "nginx-$NGINX_VERSION.tar.gz"
fi
cd ..
#
# Copy default configure script if not exists.
#
if [ ! -f "nginx_configure.sh" ]; then
cp nginx_configure.sh.default nginx_configure.sh
fi
#
# Build and install (or run tests).
#
cd "build/nginx-$NGINX_VERSION"
./../../nginx_configure.sh
make
if [ $TEST = "true" ]; then
cd ../../
TEST_NGINX_BINARY="./build/nginx-$NGINX_VERSION/objs/nginx" prove ./t
else
make install
fi