Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1if [ -e .attrs.sh ]; then source .attrs.sh; fi 2source "${stdenv}/setup" 3echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" 4mkdir -p "${out}" 5 6cat <<EOF > "${out}/compositeImage.sh" 7#! ${bash}/bin/bash 8# 9# Create a tar archive of a docker image's layers, docker image config 10# json, manifest.json, and repositories json; this streams directly to 11# stdout and is intended to be used in concert with docker load, i.e: 12# 13# ${out}/compositeImage.sh | docker load 14 15# The first character follow the 's' command for sed becomes the 16# delimiter sed will use; this makes the transformation regex easy to 17# read. We feed tar a file listing the files we want in the archive, 18# because the paths are absolute and docker load wants them flattened in 19# the archive, we need to transform all of the paths going in by 20# stripping everything *including* the last solidus so that we end up 21# with the basename of the path. 22${gnutar}/bin/tar \ 23 --transform='s=.*/==' \ 24 --transform="s=.*-manifest.json=manifest.json=" \ 25 --transform="s=.*-repositories=repositories=" \ 26 -c "${manifest}" "${repositories}" -T "${imageFileStorePaths}" 27EOF 28chmod +x "${out}/compositeImage.sh"