代码拉取完成,页面将自动刷新
同步操作将从 刘明野/qemu-user-static 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
set -xe
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts "r:v:t:d:" opt; do
case "$opt" in
r) REPO=$OPTARG
;;
v) VERSION=$OPTARG
;;
t) TAG_VER=$OPTARG
;;
d) DOCKER_REPO=$OPTARG
;;
esac
done
if [ -z "$VERSION" ]; then
echo "usage: $0 -v VERSION" 2>&1
echo "check https://github.com/${REPO}/releases for available versions" 2>&1
exit 1
fi
shift $((OPTIND-1))
[ "$1" = "--" ] && shift
from_arch="x86_64"
to_archs="aarch64 aarch64_be alpha armeb arm cris hppa i386 m68k microblazeel microblaze mips64el mips64 mipsel mipsn32el mipsn32 mips nios2 or1k ppc64abi32 ppc64le ppc64 ppc riscv32 riscv64 s390x sh4eb sh4 sparc32plus sparc64 sparc tilegx x86_64 xtensaeb xtensa"
# For casual test
# to_archs="aarch64"
# Build container images creating the directory.
# containers/
# latest/ - An image including /usr/bin/qemu-$arch-status and /register script.
# ${from_arch}_qemu-${to_arch}/ - Images including /usr/bin/qemu-$arch-status
# register/ - An image including /register script.
out_dir="containers"
# Generate register files.
cp -p "${out_dir}/latest/register.sh" "${out_dir}/register/"
cp -p "${out_dir}/latest/Dockerfile" "${out_dir}/register/"
# Comment out the line to copy qemu-*-static not to provide those.
sed -i '/^COPY qemu/ s/^/#/' "${out_dir}/register/Dockerfile"
for to_arch in $to_archs; do
if [ "$from_arch" != "$to_arch" ]; then
work_dir="${out_dir}/${from_arch}_qemu-${to_arch}"
mkdir -p "${work_dir}"
tar_gz_url="https://github.com/${REPO}/releases/download/v${VERSION}/${from_arch}_qemu-${to_arch}-static.tar.gz"
http_status="$(curl -s -o /dev/null -w "%{http_code}" "${tar_gz_url}")"
if [ "${http_status}" = 404 ]; then
echo "URL not found: ${tar_gz_url}" 1>&2
exit 1
fi
curl -sSL -o "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" "${tar_gz_url}"
tar xzvf "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" -C "${work_dir}"
rm -f "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz"
cp -p "${work_dir}/qemu-${to_arch}-static" "${out_dir}/latest/"
cat > ${work_dir}/Dockerfile -<<EOF
FROM scratch
COPY qemu-${to_arch}-static /usr/bin/
EOF
docker build -t ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${work_dir}
for target in "${DOCKER_REPO}:$from_arch-$to_arch" \
"${DOCKER_REPO}:$to_arch-${TAG_VER}" \
"${DOCKER_REPO}:$to_arch" ; do
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} "${target}"
done
rm -rf "${work_dir}"
fi
done
docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。