[Qemu-devel] [PATCH v3 17/20] docker: debian-bootstrap.pre allow customising of variant/url

Alex Bennée posted 20 patches 7 years, 4 months ago
[Qemu-devel] [PATCH v3 17/20] docker: debian-bootstrap.pre allow customising of variant/url
Posted by Alex Bennée 7 years, 4 months ago
We default to the buildd variant as most of our images are for
building. However lets give the user the ability to specify "minbase"
if they want to create a simple base image for experimentation.

Allowing the tweaking of DEB_URL means we can also bootstrap other
Debian based OS's. For example:

  make docker-binfmt-image-debian-ubuntu-bionic-arm64 \
       DEB_ARCH=arm64 DEB_TYPE=bionic \
       DEB_VARIANT=minbase DEB_URL=http://ports.ubuntu.com/ \
       EXECUTABLE=./aarch64-linux-user/qemu-aarch64

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/debian-bootstrap.pre | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/docker/dockerfiles/debian-bootstrap.pre b/tests/docker/dockerfiles/debian-bootstrap.pre
index 7c76dce663..56e1aa7a21 100755
--- a/tests/docker/dockerfiles/debian-bootstrap.pre
+++ b/tests/docker/dockerfiles/debian-bootstrap.pre
@@ -32,6 +32,15 @@ if [ -z "${DEB_TYPE}" ]; then
 
 fi
 
+# The following allow finer grain control over the defaults
+if [ -z "${DEB_VARIANT}" ]; then
+    DEB_VARIANT=buildd
+fi
+
+if [ -z "${DEB_URL}" ]; then
+    DEB_URL="http://httpredir.debian.org/debian"
+fi
+
 # We check in order for
 #
 #  - DEBOOTSTRAP_DIR pointing at a development checkout
@@ -107,5 +116,5 @@ 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
+${FAKEROOT} ${DEBOOTSTRAP} --variant=$DEB_VARIANT --foreign --arch=$DEB_ARCH $DEB_TYPE . $DEB_URL || exit 1
 exit 0
-- 
2.17.1


Re: [Qemu-devel] [PATCH v3 17/20] docker: debian-bootstrap.pre allow customising of variant/url
Posted by Philippe Mathieu-Daudé 7 years, 4 months ago
On 07/02/2018 11:30 AM, Alex Bennée wrote:
> We default to the buildd variant as most of our images are for
> building. However lets give the user the ability to specify "minbase"
> if they want to create a simple base image for experimentation.
> 
> Allowing the tweaking of DEB_URL means we can also bootstrap other
> Debian based OS's. For example:
> 
>   make docker-binfmt-image-debian-ubuntu-bionic-arm64 \
>        DEB_ARCH=arm64 DEB_TYPE=bionic \
>        DEB_VARIANT=minbase DEB_URL=http://ports.ubuntu.com/ \
>        EXECUTABLE=./aarch64-linux-user/qemu-aarch64
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/docker/dockerfiles/debian-bootstrap.pre | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/docker/dockerfiles/debian-bootstrap.pre b/tests/docker/dockerfiles/debian-bootstrap.pre
> index 7c76dce663..56e1aa7a21 100755
> --- a/tests/docker/dockerfiles/debian-bootstrap.pre
> +++ b/tests/docker/dockerfiles/debian-bootstrap.pre
> @@ -32,6 +32,15 @@ if [ -z "${DEB_TYPE}" ]; then
>  
>  fi
>  
> +# The following allow finer grain control over the defaults
> +if [ -z "${DEB_VARIANT}" ]; then
> +    DEB_VARIANT=buildd
> +fi
> +
> +if [ -z "${DEB_URL}" ]; then
> +    DEB_URL="http://httpredir.debian.org/debian"
> +fi
> +
>  # We check in order for
>  #
>  #  - DEBOOTSTRAP_DIR pointing at a development checkout
> @@ -107,5 +116,5 @@ 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
> +${FAKEROOT} ${DEBOOTSTRAP} --variant=$DEB_VARIANT --foreign --arch=$DEB_ARCH $DEB_TYPE . $DEB_URL || exit 1
>  exit 0
>