Skip to content

Commit a2ed8c9

Browse files
committed
build.sh: allow selection of container platform
Note that with podman < 5.5.1 we cannot have both linux/amd64 and linux/amd64/v2. And using a completely different arch requires emulation. Signed-off-by: Yann Dirson <[email protected]>
1 parent 81eff91 commit a2ed8c9

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,25 @@ die_usage() {
1515

1616
usage() {
1717
cat <<EOF
18-
Usage: $0 <version>
18+
Usage: $0 [--platform PF] <version>
1919
... where <version> is a 'x.y' version such as 8.0.
20+
21+
--platform override the default platform for the build container.
2022
EOF
2123
}
2224

25+
PLATFORM=
2326
while [ $# -ge 1 ]; do
2427
case "$1" in
2528
--help|-h)
2629
usage
2730
exit 0
2831
;;
32+
--platform)
33+
[ $# -ge 2 ] || die_usage "$1 needs an argument"
34+
PLATFORM="$2"
35+
shift
36+
;;
2937
-*)
3038
die_usage "unknown flag '$1'"
3139
;;
@@ -65,19 +73,19 @@ case "$1" in
6573
9.*)
6674
DOCKERFILE=Dockerfile-9.x
6775
ALMA_VERSION=10.0
68-
PLATFORM=linux/amd64/v2
76+
: ${PLATFORM:=linux/amd64/v2}
6977
;;
7078
8.*)
7179
REPO_FILE=files/xcp-ng.repo.8.x.in
7280
DOCKERFILE=Dockerfile-8.x
7381
CENTOS_VERSION=7.5.1804
74-
PLATFORM=linux/amd64
82+
: ${PLATFORM:=linux/amd64}
7583
;;
7684
7.*)
7785
REPO_FILE=files/xcp-ng.repo.7.x.in
7886
DOCKERFILE=Dockerfile-7.x
7987
CENTOS_VERSION=7.2.1511
80-
PLATFORM=linux/amd64
88+
: ${PLATFORM:=linux/amd64}
8189
;;
8290
*)
8391
echo >&2 "Unsupported release '$1'"

0 commit comments

Comments
 (0)