@@ -8,19 +8,21 @@ MIRROR_BASE=http://${MIRROR_HOST:-127.0.0.1}:3142
88LXC=0
99VBOX=0
1010DOCKER=0
11+ DOCKER_IMAGE_HASH=" "
1112
1213usage () {
1314 echo " Usage: ${0##*/ } [OPTION]..."
1415 echo " Make a base client."
1516 echo
1617 cat << EOF
17- --help display this help and exit
18- --distro D build distro D (e.g. debian) instead of ubuntu
19- --suite U build suite U instead of xenial
20- --arch A build architecture A (e.g. i386) instead of amd64
21- --lxc use lxc instead of kvm
22- --vbox use VirtualBox instead of kvm
23- --docker use docker instead of kvm
18+ --help display this help and exit
19+ --distro D build distro D (e.g. debian) instead of ubuntu
20+ --suite U build suite U instead of xenial
21+ --arch A build architecture A (e.g. i386) instead of amd64
22+ --lxc use lxc instead of kvm
23+ --vbox use VirtualBox instead of kvm
24+ --docker use docker instead of kvm
25+ --docker-image-hash D digest of the docker image to build from
2426
2527 The MIRROR_HOST environment variable can be used to change the
2628 apt-cacher host. It should be something that both the host and the
@@ -42,6 +44,11 @@ usage() {
4244 This is done as separate variable to make it clear that we modify sudo
4345 behaviour here regarding security (though anyway env is cleared with
4446 whitelist so should be perfectly safe).
47+
48+ The --docker-image-hash option can be used to specify the hash of a particular
49+ base image to use. These hashes can be found under the "RepoDigests" field of
50+ "docker image inspect <image>". They will be reported in the form "sha256:<hash>";
51+ only need the <hash> part is needed
4552EOF
4653}
4754
@@ -76,6 +83,10 @@ if [ $# != 0 ] ; then
7683 DOCKER=1
7784 shift 1
7885 ;;
86+ --docker-image-digest)
87+ DOCKER_IMAGE_HASH=" $2 "
88+ shift 2
89+ ;;
7990 --* )
8091 echo " unrecognized option $1 "
8192 exit 1
@@ -166,9 +177,16 @@ if [ $DOCKER = "1" ]; then
166177 mkdir -p docker
167178 cd docker
168179
180+ if [ -n " $DOCKER_IMAGE_HASH " ]; then
181+ base_image=" $DISTRO @sha256:$DOCKER_IMAGE_HASH "
182+ OUT=base-$DOCKER_IMAGE_HASH -$ARCH
183+ else
184+ base_image=" $DISTRO :$SUITE "
185+ fi
186+
169187 # Generate the dockerfile
170188 cat << EOF > $OUT .Dockerfile
171- FROM $DISTRO : $SUITE
189+ FROM $base_image
172190
173191ENV DEBIAN_FRONTEND=noninteractive
174192RUN apt-get update && apt-get --no-install-recommends -y install $addpkg
0 commit comments