test: container creation script with /dev/null
Add a script that creates a container image as an oci-archive that contains /dev/null.
This commit is contained in:
parent
dbfeae4110
commit
0507a9807c
1 changed files with 27 additions and 0 deletions
27
test/data/scripts/mkcontainerdevnull.sh
Executable file
27
test/data/scripts/mkcontainerdevnull.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
#
|
||||||
|
# Create a container as an oci-archive that contains /dev/null.
|
||||||
|
#
|
||||||
|
# Used to test embedding containers that contain device nodes in ostree commits
|
||||||
|
# (https://github.com/coreos/rpm-ostree/pull/5114).
|
||||||
|
#
|
||||||
|
# Requires root to create the node and to copy it into the container image.
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d -p .)
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
rm -r "${tmpdir}"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
echo "This is a simple container that contains /dev/null for testing rpm-ostree commit creation." > "${tmpdir}/README"
|
||||||
|
|
||||||
|
mkdir "${tmpdir}/dev"
|
||||||
|
mknod -m 666 "${tmpdir}/dev/null" c 1 3
|
||||||
|
|
||||||
|
amd=$(buildah from --arch=amd64 scratch)
|
||||||
|
buildah config --created-by "Achilleas Koutsou" "${amd}"
|
||||||
|
buildah copy "${amd}" "${tmpdir}" /
|
||||||
|
buildah commit --format=oci --rm "${amd}" oci-archive:container-with-devnull.tar
|
||||||
Loading…
Add table
Add a link
Reference in a new issue