my_buildctl : split into 2 functions

This commit is contained in:
Gitouche 2022-03-06 00:40:36 +01:00
parent 9d64a47bc9
commit b4a445ada7
1 changed files with 18 additions and 10 deletions

View File

@ -260,25 +260,19 @@ get_podman_volume_path () {
podman volume inspect --format '{{ .Mountpoint }}' ${1}
}
# Execute buildctl directly from the web
my_buildctl () {
opts=$(echo -n "$@")
# Execute elf binary from stdin
elfexec () {
opts=$(echo "$@")
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 "
python3 -c "
import ctypes, os;
from sys import stdin;
l = ctypes.CDLL(None);
@ -290,3 +284,17 @@ p = '/proc/self/fd/%d' % f;
myargs='${opts}';
os.execve(p, ['buildctl'] + myargs.split(), {'PATH': '${PATH}'})"
}
# Execute buildctl directly from the web
my_buildctl () {
if [[ $(uname -i) == 'aarch64' ]]; then
buildkitarch='arm64'
elif [[ $(uname -i) == 'x86_64' ]]; then
buildkitarch='amd64'
else
# defaults to amd64
buildkitarch='amd64'
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 | elfexec "${@}"
}