-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild
More file actions
executable file
·82 lines (70 loc) · 1.59 KB
/
Build
File metadata and controls
executable file
·82 lines (70 loc) · 1.59 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
#!/bin/sh
export USER IMAGE PLATFORM BUILD PIES_TAG NOCACHE OSVERSION
USER=graygnuorg
IMAGE=varnish
BUILD=latest
OSVERSION=latest
PLATFORM=
while [ $# -gt 0 ]
do
case $1 in
--no-cache)
NOCACHE=1
shift;;
--debug|-x)
set -x
shift;;
--build=*)
BUILD=${1##--build=}
shift;;
--build|-b)
shift
BUILD=${1:?--build requires argument}
shift;;
-b*)
BUILD=${1##-b}
shift;;
-*) echo >&2 "$0: unknown option: $1"
exit 1;;
--) shift
break;;
*) break;;
esac
done
case $# in
1) PLATFORM=$1
shift;;
0) echo >&2 "$0: required argument missing"
exit 1;;
*) echo >&2 "$0: too many arguments"
exit 1;;
esac
if [ ! -d $PLATFORM ]; then
echo >&2 "$0: unknown platform $PLATFORM"
exit 1
fi
if [ -x $PLATFORM/build.sh ]; then
BUILDER=$PLATFORM/build.sh
elif [ -f $PLATFORM/Dockerfile ]; then
BUILDER=./build.sh
else
echo >&2 "$0: don't know how to build $IMAGE for $PLATFORM"
exit 1
fi
IMAGENAME=${USER}/${IMAGE}:${PLATFORM}-${BUILD}
export IMAGENAME
awk '
/^[[:blank:]]*#/ { next }
/^[[:blank:]]*$/ { next }
state == 0 && /^build='$BUILD'$/ { state=1 }
state == 0 { next }
state == 1 && /^platform='$PLATFORM'$/ { next }
state == 1 && /^platform=/ { state=0 }
state == 1 && /=/ { sub(/[[:blank:]]*=[[:blank:]]*/, "="); }
state == 1 && /^os[[:blank:]]+'$PLATFORM'=/ { sub(/^os[[:blank:]].*=/, "OSVERSION="); print "export " $0; next }
state == 1 && /^[A-Za-z_][A-Za-z_0-9]*=/ { print "export " $0 }
state == 1 && /\f/ { exit }
' buildtab > conf.$$
. ./conf.$$
rm conf.$$
exec $BUILDER