aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2021-10-21 10:51:44 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-10-21 10:51:44 +0200
commit75d7ba327c72a681588290d84cedecf8f410d861 (patch)
tree8e742115079538a4f5dc02919d510a38e903691d
parent7198d78d4f6ae28f70e6c11098dc712a4704d29e (diff)
downloadimagefish-75d7ba327c72a681588290d84cedecf8f410d861.tar.gz
virt-builder index
-rw-r--r--.gitlab-ci.yml1
-rwxr-xr-xscripts/make-index.sh46
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