forked from docker-library/haproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·87 lines (76 loc) · 2.37 KB
/
update.sh
File metadata and controls
executable file
·87 lines (76 loc) · 2.37 KB
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
#!/bin/bash
set -Eeuo pipefail
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
defaultDebianSuite='stretch-slim'
declare -A debianSuite=(
#[1.6]='jessie-backports'
#[1.5]='jessie'
)
defaultAlpineVersion='3.8'
declare -A alpineVersion=(
#[1.5]='3.5'
)
travisEnv=
for version in "${versions[@]}"; do
rcGrepV='-v'
rcVersion="${version%-rc}"
if [ "$rcVersion" != "$version" ]; then
rcGrepV=
fi
fullVersion="$(
{
curl -fsSL --compressed 'https://www.haproxy.org/download/'"$rcVersion"'/src/'
if [ "$rcVersion" != "$version" ]; then
curl -fsSL --compressed 'https://www.haproxy.org/download/'"$rcVersion"'/src/devel/'
fi
} \
| grep -o '<a href="haproxy-'"$rcVersion"'[^"/]*\.tar\.gz"' \
| sed -r 's!^<a href="haproxy-([^"/]+)\.tar\.gz"$!\1!' \
| grep $rcGrepV -E 'rc|dev' \
| sort -V \
| tail -1
)"
url="https://www.haproxy.org/download/$rcVersion/src"
if [[ "$fullVersion" == *dev* ]]; then
url+='/devel'
fi
url+="/haproxy-$fullVersion.tar.gz"
sha256="$(curl -fsSL --compressed "$url.sha256" | cut -d' ' -f1)"
echo "$version: $fullVersion ($sha256, $url)"
versionSuite="${debianSuite[$version]:-$defaultDebianSuite}"
alpine="${alpineVersion[$version]:-$defaultAlpineVersion}"
sedExpr='
s/%%ALPINE_VERSION%%/'"$alpine"'/;
s/%%DEBIAN_VERSION%%/'"$versionSuite"'/;
s/%%HAPROXY_VERSION%%/'"$fullVersion"'/;
s!%%HAPROXY_URL%%!'"$url"'!;
s/%%HAPROXY_SHA256%%/'"$sha256"'/;
'
if [ "$version" = '1.5' ]; then
sedExpr+='
/lua/d;
'
fi
if [ "$version" = 1.5 ] || [ "$version" = 1.6 ]; then
# libssl1.1 is not supported until 1.7+
# https://git.haproxy.org/?p=haproxy-1.7.git;a=commitdiff;h=1866d6d8f1163fe28a1e8256080909a5aa166880
sedExpr+='
s/libssl-dev/libssl1.0-dev/;
'
fi
sed -r "$sedExpr" 'Dockerfile-debian.template' > "$version/Dockerfile"
for variant in alpine; do
[ -d "$version/$variant" ] || continue
sed -r "$sedExpr" 'Dockerfile-alpine.template' > "$version/$variant/Dockerfile"
travisEnv='\n - VERSION='"$version VARIANT=$variant$travisEnv"
done
travisEnv='\n - VERSION='"$version ARCH=i386$travisEnv"
travisEnv='\n - VERSION='"$version VARIANT=$travisEnv"
done
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
echo "$travis" > .travis.yml