diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2021-10-21 10:51:44 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2021-10-21 10:51:44 +0200 |
commit | 75d7ba327c72a681588290d84cedecf8f410d861 (patch) | |
tree | 8e742115079538a4f5dc02919d510a38e903691d | |
parent | 7198d78d4f6ae28f70e6c11098dc712a4704d29e (diff) | |
download | imagefish-75d7ba327c72a681588290d84cedecf8f410d861.tar.gz |
virt-builder index
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rwxr-xr-x | scripts/make-index.sh | 46 |
2 files changed, 47 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6835d63..0593277 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +17,7 @@ variables: done - xz --verbose $(ls *.tar *.qcow2) - mv --verbose *.xz $CI_JOB_NAME + - (cd $CI_JOB_NAME; for info in *.info; do ../scripts/make-index.sh $info; done) - name="$CI_JOB_NAME images" - base="$CI_JOB_URL/artifacts/raw/$CI_JOB_NAME" - tree -i -f -s -h -D --charset utf8 -T "$name" -H "$base" $CI_JOB_NAME > index.html diff --git a/scripts/make-index.sh b/scripts/make-index.sh new file mode 100755 index 0000000..68c41f7 --- /dev/null +++ b/scripts/make-index.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# create virt builder index snippets +# + +info="$1" +base="${info%.info}" +dest="${base}.index" +name="${base##*/}" + +file="$(jq -r .filename $info)" +if test ! -f "$file"; then + file="${file}.xz" +fi +if test ! -f "$file"; then + echo "ERROR: file ${file} not found" + exit 1 +fi + +name="${name%-x86_64}" +case "$file" in + *x86_64*) + arch="x86_64" + ;; + *) + echo "ERROR: unknown arch" + exit 1 + ;; +esac + +size="$(jq -r '."virtual-size"' $info)" +csum="$(sha256sum $file | cut -d' ' -f1)" +comp="$(du --bytes $file | cut -d' ' -f1)" + +cat <<EOF | tee "$dest" +[${name}] +name=${name} +arch=${arch} +file=${file} +checksum[sha512]=${csum} +format=qcow2 +size=${size} +compressed_size=148947524 +#expand=/dev/sda<x> + +EOF |