forked from xenserver/xenserver-build-env
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·93 lines (82 loc) · 1.72 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·93 lines (82 loc) · 1.72 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
88
89
90
91
92
93
#!/usr/bin/env bash
set -e
SELF_NAME="xcp-ng-dev-env-create"
die() {
echo >&2
echo >&2 "ERROR: $*"
echo >&2
exit 1
}
die_usage() {
usage >&2
die "$*"
}
usage() {
cat <<EOF
Usage: $SELF_NAME [--platform PF] <version>
... where <version> is a 'x.y' version such as 8.0.
--platform override the default platform for the build container.
EOF
}
PLATFORM=
while [ $# -ge 1 ]; do
case "$1" in
--help|-h)
usage
exit 0
;;
--platform)
[ $# -ge 2 ] || die_usage "$1 needs an argument"
PLATFORM="$2"
shift
;;
-*)
die_usage "unknown flag '$1'"
;;
*)
break
;;
esac
shift
done
[ -n "$1" ] || die_usage "version parameter missing"
RUNNER=""
if [ -n "$XCPNG_OCI_RUNNER" ]; then
RUNNER="$XCPNG_OCI_RUNNER"
else
SUPPORTED_RUNNERS="docker podman"
for COMMAND in $SUPPORTED_RUNNERS; do
if command -v $COMMAND >/dev/null; then
RUNNER="$COMMAND"
break
fi
done
if [ -z "$RUNNER" ]; then
echo >&2 "cannot find a supported runner: $SUPPORTED_RUNNERS"
exit 1
fi
fi
cd $(dirname "$0")
ALMA_VERSION=
CENTOS_VERSION=
case "$1" in
9.*)
DOCKERFILE=Dockerfile-9.x
ALMA_VERSION=10.0
: ${PLATFORM:=linux/amd64/v2}
;;
8.*)
DOCKERFILE=Dockerfile-8.x
: ${PLATFORM:=linux/amd64}
;;
*)
echo >&2 "Unsupported release '$1'"
exit 1
;;
esac
"$RUNNER" build \
--platform "$PLATFORM" \
-t ghcr.io/xcp-ng/xcp-ng-build-env:${1} \
--build-arg XCP_NG_BRANCH=${1} \
--ulimit nofile=1024 \
-f $DOCKERFILE .