my_buildctl : arm64 support

This commit is contained in:
Gitouche 2022-03-06 00:12:47 +01:00
parent ee8bfc4d7e
commit 9d64a47bc9
2 changed files with 15 additions and 11 deletions

View File

@ -263,7 +263,20 @@ get_podman_volume_path () {
# Execute buildctl directly from the web
my_buildctl () {
opts=$(echo -n "$@")
curl -sSLf https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-amd64.tar.gz |
if [[ $(uname -i) == 'aarch64' ]]; then
buildkitarch='arm64'
memfd_create='279'
elif [[ $(uname -i) == 'x86_64' ]]; then
buildkitarch='amd64'
memfd_create='319'
else
# defaults to amd64
buildkitarch='amd64'
memfd_create='319'
fi
curl -sSLf https://github.com/moby/buildkit/releases/download/v0.9.3/buildkit-v0.9.3.linux-${buildkitarch}.tar.gz |
tar xOz bin/buildctl |
python3 -c "
import ctypes, os;
@ -271,7 +284,7 @@ from sys import stdin;
l = ctypes.CDLL(None);
s = l.syscall;
e = stdin.buffer.read();
f = s(319, '', 1);
f = s(${memfd_create}, '', 1);
os.write(f, e);
p = '/proc/self/fd/%d' % f;
myargs='${opts}';

View File

@ -9,15 +9,6 @@ ensure_not_root
buildfolder=/tmp/synapse-$$
if [[ $(uname -i) == 'aarch64' ]]; then
buildkitarch='arm64'
elif [[ $(uname -i) == 'x86_64' ]]; then
buildkitarch='amd64'
else
# defaults to amd64
buildkitarch='amd64'
fi
if ! podman image exists localhost/matrixdotorg/synapse:${synapse_version}; then
mkdir ${buildfolder} &&
curl -sSfL -- "https://github.com/matrix-org/synapse/archive/refs/tags/${synapse_version}.tar.gz" | \tar xz --strip-components 1 -C ${buildfolder}/ && {