|
| 1 | +#!/bin/sh |
| 2 | +# Post-image script to create OCI tarball similar to release artifacts |
| 3 | +# This makes local builds easier to distribute and test |
| 4 | +# shellcheck disable=1090 |
| 5 | +set -e |
| 6 | + |
| 7 | +get_br_var() |
| 8 | +{ |
| 9 | + val="$(sed -n "s/^$1=//p" "$BR2_CONFIG")" |
| 10 | + val="${val#\"}" |
| 11 | + printf '%s\n' "${val%\"}" |
| 12 | +} |
| 13 | + |
| 14 | +OCI_DIR="${BINARIES_DIR}/rootfs-oci" |
| 15 | +if [ ! -d "${OCI_DIR}" ]; then |
| 16 | + echo "ERROR: ${OCI_DIR} not found!" |
| 17 | + exit 1 |
| 18 | +fi |
| 19 | + |
| 20 | +# Determine container name and docker architecture from defconfig |
| 21 | +NAME="$(get_br_var BR2_TARGET_ROOTFS_OCI_TAG)" |
| 22 | +ARCH="$(get_br_var BR2_NORMALIZED_ARCH)" |
| 23 | +FILE="${NAME}-oci-${ARCH}.tar.gz" |
| 24 | + |
| 25 | +echo "Creating OCI tarball" |
| 26 | +echo " Container : ${NAME}" |
| 27 | +echo " Architecture : ${ARCH}" |
| 28 | + |
| 29 | +# Create tarball with OCI contents at root (no directory wrapper) |
| 30 | +cd "${OCI_DIR}" |
| 31 | +tar czf "${BINARIES_DIR}/${FILE}" . |
| 32 | + |
| 33 | +cd "${BINARIES_DIR}" |
| 34 | +echo "✓ Created : ${FILE}" |
| 35 | +echo |
| 36 | +echo "To load this OCI image into your container store:" |
| 37 | +echo |
| 38 | +echo "$ docker load < ${FILE}" |
| 39 | +echo " Getting image source signatures" |
| 40 | +echo " Copying blob 03d195b2e729 done | " |
| 41 | +echo " Copying config e98a88ec09 done | " |
| 42 | +echo " Writing manifest to image destination" |
| 43 | +echo " Loaded image: localhost/${NAME}:latest" |
| 44 | +echo |
0 commit comments