-
Notifications
You must be signed in to change notification settings - Fork 96
/
package-apisix.sh
executable file
·104 lines (97 loc) · 2.96 KB
/
package-apisix.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
set -euo pipefail
set -x
mkdir /output
dist=$(cat /tmp/dist)
ARCH=${ARCH:-`(uname -m | tr '[:upper:]' '[:lower:]')`}
# Determine the dependencies
dep_ldap="openldap-devel"
dep_libyaml="libyaml-devel"
if [ "$PACKAGE_TYPE" == "deb" ]
then
# the pkg contains the so library could be libldap-2.5 or libldap-2.4-2
dep_ldap="libldap2-dev"
dep_libyaml="libyaml-dev"
fi
dep_pcre="pcre"
if [ "$PACKAGE_TYPE" == "deb" ]
then
dep_pcre="libpcre3"
fi
dep_which="which"
if [ "$PACKAGE_TYPE" == "deb" ]
then
dep_which="debianutils"
fi
# Determine the min version of openresty or apisix-base
if [ "$OPENRESTY" == "apisix-base" ]
then
min_or_version="1.21.4.1.7"
max_or_version="1.21.5"
elif [ "$OPENRESTY" == "apisix-base-latest" ]
then
# For CI
OPENRESTY="apisix-base"
min_or_version="latest"
max_or_version="latest-1"
else
min_or_version="1.19.3.2"
max_or_version="1.21.5"
fi
# Determine the name of artifact
# The defaut is apisix
artifact="apisix"
if [ "$ARTIFACT" != "0" ]
then
artifact=${ARTIFACT}
fi
if [ "$OPENRESTY" == "apisix-runtime" ]
then
fpm -f -s dir -t "$PACKAGE_TYPE" \
--"$PACKAGE_TYPE"-dist "$dist" \
-n "$artifact" \
-a "$(uname -i)" \
-v "$PACKAGE_VERSION" \
--iteration "$ITERATION" \
-d "$dep_ldap" \
-d "$dep_pcre" \
-d "$dep_which" \
-d "$dep_libyaml" \
--post-install post-install-apisix-runtime.sh \
--description 'Apache APISIX is a distributed gateway for APIs and Microservices, focused on high performance and reliability.' \
--license "ASL 2.0" \
-C /tmp/build/output/apisix \
-p /output \
--url 'http://apisix.apache.org/' \
--config-files usr/lib/systemd/system/apisix.service \
--config-files usr/lib/systemd/system/openresty.service \
--config-files usr/local/apisix/conf/config.yaml
else
fpm -f -s dir -t "$PACKAGE_TYPE" \
--"$PACKAGE_TYPE"-dist "$dist" \
-n "$artifact" \
-a "$(uname -i)" \
-v "$PACKAGE_VERSION" \
--iteration "$ITERATION" \
-d "$OPENRESTY >= $min_or_version" \
-d "$OPENRESTY < $max_or_version" \
-d "$dep_ldap" \
-d "$dep_pcre" \
-d "$dep_which" \
--description 'Apache APISIX is a distributed gateway for APIs and Microservices, focused on high performance and reliability.' \
--license "ASL 2.0" \
-C /tmp/build/output/apisix \
-p /output \
--url 'http://apisix.apache.org/' \
--config-files usr/lib/systemd/system/apisix.service \
--config-files usr/local/apisix/conf/config.yaml
fi
PACKAGE_ARCH="amd64"
if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then
PACKAGE_ARCH="arm64"
fi
# Rename deb file with adding $DIST section
if [ "$PACKAGE_TYPE" == "deb" ]
then
mv /output/apisix_${PACKAGE_VERSION}-${ITERATION}_"${PACKAGE_ARCH}".deb /output/apisix_${PACKAGE_VERSION}-${ITERATION}~${dist}_"${PACKAGE_ARCH}".deb
fi