blob: 68c41f77c77532d53941a85e5cdf565d9426239d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|