Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' …
…into staging # gpg: Signature made Wed 20 Jul 2016 12:19:56 BST # gpg: using RSA key 0xCA35624C6A9171C6 # gpg: Good signature from "Fam Zheng <famz@redhat.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6 * remotes/famz/tags/docker-pull-request: docker: pass EXECUTABLE to build script docker: Don't start a container that doesn't exist docker: Add "images" subcommand to docker.py docker: Fix exit code if $CMD failed docker: More sensible run script tests/docker/docker.py: add update operation tests/docker/dockerfiles: new debian-bootstrap.docker tests/docker/docker.py: check and run .pre script tests/docker/docker.py: support --include-executable tests/docker/docker.py: docker_dir outside build Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
- Loading branch information
Showing
5 changed files
with
280 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Create Debian Bootstrap Image | ||
# | ||
# This is intended to be pre-poluated by: | ||
# - a first stage debootstrap (see debian-bootstrap.pre) | ||
# - a native qemu-$arch that binfmt_misc will run | ||
FROM scratch | ||
|
||
# Add everything from the context into the container | ||
ADD . / | ||
|
||
# Patch all mounts as docker already has stuff set up | ||
RUN sed -i 's/in_target mount/echo not for docker in_target mount/g' /debootstrap/functions | ||
|
||
# Run stage 2 | ||
RUN /debootstrap/debootstrap --second-stage | ||
|
||
# At this point we can install additional packages if we want | ||
# Duplicate deb line as deb-src | ||
RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list | ||
RUN apt-get update | ||
RUN apt-get -y build-dep qemu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/sh | ||
# | ||
# Simple wrapper for debootstrap, run in the docker build context | ||
# | ||
FAKEROOT=`which fakeroot 2> /dev/null` | ||
|
||
exit_and_skip() | ||
{ | ||
exit 3 | ||
} | ||
|
||
# | ||
# fakeroot is needed to run the bootstrap stage | ||
# | ||
if [ -z $FAKEROOT ]; then | ||
echo "Please install fakeroot to enable bootstraping" | ||
exit_and_skip | ||
fi | ||
|
||
# We check in order for | ||
# | ||
# - DEBOOTSTRAP_DIR pointing at a development checkout | ||
# - PATH for the debootstrap script (installed) | ||
# | ||
# If neither option works then we checkout debootstrap from its | ||
# upstream SCM and run it from there. | ||
# | ||
|
||
if [ -z $DEBOOTSTRAP_DIR ]; then | ||
DEBOOTSTRAP=`which debootstrap 2> /dev/null` | ||
if [ -z $DEBOOTSTRAP ]; then | ||
echo "No debootstrap installed, attempting to install from SCM" | ||
DEBOOTSTRAP_SOURCE=https://anonscm.debian.org/git/d-i/debootstrap.git | ||
git clone ${DEBOOTSTRAP_SOURCE} ./debootstrap.git | ||
export DEBOOTSTRAP_DIR=./debootstrap.git | ||
DEBOOTSTRAP=./debootstrap.git/debootstrap | ||
fi | ||
else | ||
DEBOOTSTRAP=${DEBOOTSTRAP_DIR}/debootstrap | ||
if [ ! -f $DEBOOTSTRAP ]; then | ||
echo "Couldn't find script at ${DEBOOTSTRAP}" | ||
exit_and_skip | ||
fi | ||
fi | ||
|
||
# | ||
# Finally check to see if any qemu's are installed | ||
# | ||
BINFMT_DIR=/proc/sys/fs/binfmt_misc | ||
if [ ! -e $BINFMT_DIR ]; then | ||
echo "binfmt_misc needs enabling for a QEMU bootstrap to work" | ||
exit_and_skip | ||
else | ||
# DEB_ARCH and QEMU arch names are not totally aligned | ||
case "${DEB_ARCH}" in | ||
amd64) | ||
QEMU=qemu-i386 | ||
;; | ||
armel|armhf) | ||
QEMU=qemu-arm | ||
;; | ||
arm64) | ||
QEMU=qemu-aarch64 | ||
;; | ||
powerpc) | ||
QEMU=qemu-ppc | ||
;; | ||
ppc64el) | ||
QEMU=qemu-ppc64le | ||
;; | ||
s390) | ||
QEMU=qemu-s390x | ||
;; | ||
*) | ||
QEMU=qemu-${DEB_ARCH} | ||
;; | ||
esac | ||
if [ ! -e "${BINFMT_DIR}/$QEMU" ]; then | ||
echo "No binfmt_misc rule to run $QEMU, can't bootstrap" | ||
exit_and_skip | ||
fi | ||
fi | ||
|
||
echo "Building a rootfs using ${FAKEROOT} and ${DEBOOTSTRAP} ${DEB_ARCH}/${DEB_TYPE}" | ||
|
||
${FAKEROOT} ${DEBOOTSTRAP} --variant=buildd --foreign --arch=$DEB_ARCH $DEB_TYPE . http://httpredir.debian.org/debian || exit 1 | ||
exit 0 |
Oops, something went wrong.