mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-05-05 17:36:15 +00:00
Clean up GCE image build
In line with the others, support any file names on input. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
# Tag: 8719f0f33b3cf9d59a62be64a42220978ac96486
|
||||
FROM mobylinux/guestfs@sha256:c7229f01c1a54270d2bc3597c30121628c18db211ed32fb7202823b6eaa4f853
|
||||
|
||||
WORKDIR /tmp/image
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY make-gce /usr/bin
|
||||
|
||||
CMD [ "/usr/bin/make-gce" ]
|
||||
CMD [ "/make-gce" ]
|
||||
|
||||
@@ -4,7 +4,7 @@ IMAGE=mkimage-gce
|
||||
|
||||
default: push
|
||||
|
||||
hash: Dockerfile make-gce syslinux.cfg
|
||||
hash: Dockerfile make-gce
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm $(IMAGE):build sh -c "(cat $^; apt list --installed 2>/dev/null) | sha1sum" | sed 's/ .*//' > hash
|
||||
|
||||
|
||||
@@ -2,13 +2,42 @@
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p /tmp/image
|
||||
cd /tmp/image
|
||||
|
||||
# input is a tarball of vmlinuz64 and initrd.img on stdin
|
||||
# output is a compressed tarball of a raw disk image on stdout
|
||||
|
||||
mkdir -p files
|
||||
tar xf - -C files
|
||||
|
||||
cp syslinux.cfg files
|
||||
cd files
|
||||
|
||||
# extract. As guestfs base is currently Debian, no compression support
|
||||
# only if stdin is a tty, if so need files volume mounted...
|
||||
[ -t 0 ] || tar xf -
|
||||
|
||||
INITRD="$(find . -name '*.img')"
|
||||
KERNEL="$(find . -name vmlinuz64 -or -name bzImage)"
|
||||
|
||||
[ "$KERNEL" = "./vmlinuz64" ] || mv "$KERNEL" vmlinuz64
|
||||
[ "$INITRD" = "./initrd.img" ] || mv "$INITRD" initrd.img
|
||||
|
||||
# clean up subdirectories
|
||||
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
|
||||
|
||||
# should be externally provided as GCE specific
|
||||
GCE_CONFIG="earlyprintk=ttyS0,115200 console=ttyS0,115200 mobyplatform=gcp vsyscall=emulate"
|
||||
|
||||
CFG="DEFAULT linux
|
||||
LABEL linux
|
||||
KERNEL /vmlinuz64
|
||||
INITRD /initrd.img
|
||||
APPEND $GCE_CONFIG $*
|
||||
"
|
||||
|
||||
printf "$CFG" > syslinux.cfg
|
||||
|
||||
cd ..
|
||||
|
||||
tar cf files.tar -C files .
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
DEFAULT linux
|
||||
LABEL linux
|
||||
KERNEL /vmlinuz64
|
||||
INITRD /initrd.img
|
||||
APPEND earlyprintk=ttyS0,115200 console=ttyS0,115200 mobyplatform=gcp vsyscall=emulate
|
||||
Reference in New Issue
Block a user