@@ -4,33 +4,31 @@ set -xe
4
4
# A POSIX variable
5
5
OPTIND=1 # Reset in case getopts has been used previously in the shell.
6
6
7
- while getopts " r:v: t:d:" opt; do
7
+ while getopts " r:t:d:" opt; do
8
8
case " $opt " in
9
9
r) REPO=$OPTARG
10
10
;;
11
- v) VERSION=$OPTARG
12
- ;;
13
11
t) TAG_VER=$OPTARG
14
12
;;
15
13
d) DOCKER_REPO=$OPTARG
16
14
;;
17
15
esac
18
16
done
19
17
20
- if [ -z " $VERSION " ]; then
21
- echo " usage: $0 -v VERSION" 2>&1
22
- echo " check https://github.com/${REPO} /releases for available versions" 2>&1
23
- exit 1
24
- fi
25
-
26
18
shift $(( OPTIND- 1 ))
27
19
28
20
[ " $1 " = " --" ] && shift
29
21
22
+ base_path=$( pwd)
23
+ cd releases/usr/bin/
24
+ for file in * ; do
25
+ tar -czf $file .tar.gz $file ;
26
+ mv $file .tar.gz x86_64_$file .tar.gz
27
+ done
28
+ cd ${base_path}
29
+
30
30
from_arch=" x86_64"
31
31
to_archs=" aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el nios2 or1k ppc ppc64 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64 xtensa xtensaeb"
32
- # For casual test
33
- # to_archs="aarch64"
34
32
35
33
# Build container images creating the directory.
36
34
# containers/
@@ -49,18 +47,8 @@ for to_arch in $to_archs; do
49
47
if [ " $from_arch " != " $to_arch " ]; then
50
48
work_dir=" ${out_dir} /${from_arch} _qemu-${to_arch} "
51
49
mkdir -p " ${work_dir} "
52
- tar_gz_url=" https://github.com/${REPO} /releases/download/v${VERSION} /${from_arch} _qemu-${to_arch} -static.tar.gz"
53
- http_status=" $( curl -s -o /dev/null -w " %{http_code}" " ${tar_gz_url} " ) "
54
- if [ " ${http_status} " = 404 ]; then
55
- echo " URL not found: ${tar_gz_url} " 1>&2
56
- exit 1
57
- fi
58
- curl -sSL -o " ${work_dir} /${from_arch} _qemu-${to_arch} -static.tar.gz" " ${tar_gz_url} "
59
- tar xzvf " ${work_dir} /${from_arch} _qemu-${to_arch} -static.tar.gz" -C " ${work_dir} "
60
- rm -f " ${work_dir} /${from_arch} _qemu-${to_arch} -static.tar.gz"
61
-
50
+ cp -p " releases/usr/bin/qemu-${to_arch} -static" ${work_dir}
62
51
cp -p " ${work_dir} /qemu-${to_arch} -static" " ${out_dir} /latest/"
63
-
64
52
cat > ${work_dir} /Dockerfile -<< EOF
65
53
FROM scratch
66
54
COPY qemu-${to_arch} -static /usr/bin/
69
57
for target in " ${DOCKER_REPO} :$from_arch -$to_arch " \
70
58
" ${DOCKER_REPO} :$to_arch -${TAG_VER} " \
71
59
" ${DOCKER_REPO} :$to_arch " ; do
72
- docker tag ${DOCKER_REPO} :$from_arch -$to_arch -${TAG_VER} " ${target} "
60
+ docker tag ${DOCKER_REPO} :$from_arch -$to_arch -${TAG_VER} ${target}
73
61
done
74
62
rm -rf " ${work_dir} "
75
63
fi
76
64
done
77
65
78
- docker build -t ${DOCKER_REPO} :${TAG_VER} " ${out_dir} /latest"
66
+ docker build -t ${DOCKER_REPO} :${TAG_VER} ${out_dir} /latest
79
67
docker tag ${DOCKER_REPO} :${TAG_VER} ${DOCKER_REPO} :latest
80
- docker build -t ${DOCKER_REPO} :register " ${out_dir} /register"
68
+ docker build -t ${DOCKER_REPO} :register ${out_dir} /register
0 commit comments