This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
/
update.sh
executable file
·115 lines (103 loc) · 3.98 KB
/
update.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
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
set -e
cd "$(dirname $0)"
ubuntu() {
cd ubuntu
while read UBUNTU_VERSION UBUNTU_RELEASE LIBICU_VERSION; do
BASE_DIR=$UBUNTU_VERSION
TARGET_DIR=$BASE_DIR
mkdir -p $TARGET_DIR
# Update base image
sed \
-e s/'$(UBUNTU_VERSION)'/$UBUNTU_VERSION/g \
-e s/'$(UBUNTU_RELEASE)'/$UBUNTU_RELEASE/g \
-e s/'$(LIBICU_VERSION)'/$LIBICU_VERSION/g \
Dockerfile.template > $UBUNTU_VERSION/Dockerfile
if [ -n "$(which unix2dos)" ]; then
unix2dos -q $TARGET_DIR/Dockerfile
fi
cp start.sh $TARGET_DIR
BASE_TAG=ubuntu-$UBUNTU_VERSION
# Update standard image
while read TARGET_UBUNTU_VERSION UBUNTU_RELEASE DEFAULT_JDK_VERSION; do
if [ "$TARGET_UBUNTU_VERSION" == "$UBUNTU_VERSION" ]; then
TARGET_DIR=$BASE_DIR/standard
mkdir -p $TARGET_DIR
sed \
-e s/'$(VSTS_AGENT_TAG)'/$BASE_TAG/g \
-e s/'$(UBUNTU_VERSION)'/$UBUNTU_VERSION/g \
-e s/'$(UBUNTU_RELEASE)'/$UBUNTU_RELEASE/g \
-e s/'$(DEFAULT_JDK_VERSION)'/$DEFAULT_JDK_VERSION/g \
standard/Dockerfile.template > $TARGET_DIR/Dockerfile
if [ -n "$(which unix2dos)" ]; then
unix2dos -q $TARGET_DIR/Dockerfile
fi
fi
done < <(cat standard/versions | sed 's/\r//')
# Update docker images
while read DOCKER_VERSION DOCKER_COMPOSE_VERSION; do
TARGET_DIR=$BASE_DIR/docker/$DOCKER_VERSION
mkdir -p $TARGET_DIR
sed \
-e s/'$(VSTS_AGENT_TAG)'/$BASE_TAG/g \
-e s/'$(DOCKER_VERSION)'/$DOCKER_VERSION/g \
-e s/'$(DOCKER_COMPOSE_VERSION)'/$DOCKER_COMPOSE_VERSION/g \
docker/Dockerfile.template > $TARGET_DIR/Dockerfile
if [ -n "$(which unix2dos)" ]; then
unix2dos -q $TARGET_DIR/Dockerfile
fi
# Update docker-standard image
while read TARGET_UBUNTU_VERSION na; do
if [ "$TARGET_UBUNTU_VERSION" == "$UBUNTU_VERSION" ]; then
TARGET_DIR=$TARGET_DIR/standard
mkdir -p $TARGET_DIR
sed \
-e s/'$(VSTS_AGENT_TAG)'/${BASE_TAG}-standard/g \
-e s/'$(DOCKER_VERSION)'/$DOCKER_VERSION/g \
-e s/'$(DOCKER_COMPOSE_VERSION)'/$DOCKER_COMPOSE_VERSION/g \
docker/Dockerfile.template > $TARGET_DIR/Dockerfile
if [ -n "$(which unix2dos)" ]; then
unix2dos -q $TARGET_DIR/Dockerfile
fi
fi
done < <(cat standard/versions | sed 's/\r//')
done < <(cat docker/versions | sed 's/\r//')
done < <(cat versions | sed 's/\r//')
tfs() {
VSTS_AGENT_TAG=$1
TARGET_DIR=$2
mkdir -p $TARGET_DIR
sed \
-e s/'$(VSTS_AGENT_TAG)'/$VSTS_AGENT_TAG/g \
-e s/'$(VSTS_AGENT_URL)'/${VSTS_AGENT_URL//\//\\\/}/g \
tfs/Dockerfile.template > $TARGET_DIR/Dockerfile
if [ -n "$(which unix2dos)" ]; then
unix2dos -q $TARGET_DIR/Dockerfile
fi
cp tfs/start.sh $TARGET_DIR
}
# Update TFS base, standard, docker and docker-standard images
while read UBUNTU_VERSION LIBICU_VERSION; do
while read TFS_RELEASE VSTS_AGENT_URL; do
BASE_DIR=$UBUNTU_VERSION/${TFS_RELEASE/-/\/}
BASE_TAG=ubuntu-$UBUNTU_VERSION
VSTS_AGENT_URL=$(eval echo $VSTS_AGENT_URL)
tfs $BASE_TAG $BASE_DIR
while read TARGET_UBUNTU_VERSION na; do
if [ "$TARGET_UBUNTU_VERSION" == "$UBUNTU_VERSION" ]; then
tfs ${BASE_TAG}-standard $BASE_DIR/standard
fi
done < <(cat standard/versions | sed 's/\r//')
while read DOCKER_VERSION DOCKER_COMPOSE_VERSION; do
tfs ${BASE_TAG}-docker-$DOCKER_VERSION $BASE_DIR/docker/$DOCKER_VERSION
while read TARGET_UBUNTU_VERSION na; do
if [ "$TARGET_UBUNTU_VERSION" == "$UBUNTU_VERSION" ]; then
tfs ${BASE_TAG}-docker-$DOCKER_VERSION-standard $BASE_DIR/docker/$DOCKER_VERSION/standard
fi
done < <(cat standard/versions | sed 's/\r//')
done < <(cat docker/versions | sed 's/\r//')
done < <(cat tfs/releases | sed 's/\r//')
done < <(cat versions | sed 's/\r//')
cd ..
}
${1:-ubuntu}