-
Notifications
You must be signed in to change notification settings - Fork 96
/
package-apisix-base.sh
executable file
·57 lines (51 loc) · 1.78 KB
/
package-apisix-base.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
#!/usr/bin/env bash
set -euo pipefail
set -x
mkdir /output
dist=$(cat /tmp/dist)
codename=$(cat /tmp/codename)
# Determine the name of artifact
# The defaut is apisix-base
artifact="apisix-base"
if [ "$ARTIFACT" != "0" ]; then
artifact=${ARTIFACT}
fi
ARCH=${ARCH:-`(uname -m | tr '[:upper:]' '[:lower:]')`}
openresty_zlib_version="1.2.12-1"
openresty_openssl111_version="1.1.1n-1"
openresty_pcre_version="8.45-1"
if [ "$PACKAGE_TYPE" == "deb" ]; then
pkg_suffix="${codename}1"
openresty_zlib_version="$openresty_zlib_version~$pkg_suffix"
openresty_openssl111_version="$openresty_openssl111_version~$pkg_suffix"
openresty_pcre_version="$openresty_pcre_version~$pkg_suffix"
fi
fpm -f -s dir -t "$PACKAGE_TYPE" \
--"$PACKAGE_TYPE"-dist "$dist" \
-n "$artifact" \
-a "$(uname -i)" \
-v "$PACKAGE_VERSION" \
--iteration "$ITERATION" \
-x openresty/zlib \
-x openresty/openssl111 \
-x openresty/pcre \
-d "openresty-zlib >= $openresty_zlib_version" \
-d "openresty-openssl111 >= $openresty_openssl111_version" \
-d "openresty-pcre >= $openresty_pcre_version" \
--post-install post-install-apisix-base.sh \
--description "APISIX's OpenResty distribution." \
--license "ASL 2.0" \
-C /tmp/build/output \
-p /output \
--url 'http://apisix.apache.org/' \
--conflicts openresty \
--config-files usr/lib/systemd/system/openresty.service \
--prefix=/usr/local
PACKAGE_ARCH="amd64"
if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then
PACKAGE_ARCH="arm64"
fi
if [ "$PACKAGE_TYPE" == "deb" ]; then
# Rename deb file with adding $DIST section
mv /output/apisix-base_"${PACKAGE_VERSION}"-"${ITERATION}"_"${PACKAGE_ARCH}".deb /output/apisix-base_"${PACKAGE_VERSION}"-"${ITERATION}"~"${dist}"_"${PACKAGE_ARCH}".deb
fi