Commit 3c4d9ded authored by Ophélie Gagnard's avatar Ophélie Gagnard Committed by Ophélie Gagnard

generation: Improve shadir metadata upload.

parent d8dc19a3
......@@ -9,11 +9,32 @@ cd $GIT_ROOT
# define useful variables
source generation/00env.sh
metadata_file=metadata.json
uefi_image_name="$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -r)_${MCA_NAME_AND_VERSION}_${FLB_NAME_AND_VERSION}_${SERVER_GROUP}".efi
sha_list=installation/images-sha512.list
hash_comment="# KVM off + dummy ips, rd.neednet=1 LABEL=Root, in shadir"
networkcache-upload --conf ../tls-access-to-shacache/test.cfg --id river --file "$uefi_image_name" "server-group=$SERVER_GROUP" "kernel-version=$(uname -v | cut -d' ' -f4)" "mca-version=$MCA_VERSION" "flb-version=$FLB_VERSION" "plg-version=$PLG_VERSION" "timestamp=$(date +%s)" "comment=$hash_comment"
version_to_list () {
# take a version with no letters, and return a json list
# remove everything after "+" and "-", and separate numbers according to "."
python3 -c "import sys; print(list(map(int, sys.argv[1].split(\"+\")[0].split(\"-\")[0].split(\".\"))))" "$1"
}
# the keys "file" and "urlmd5" are sometimes mandatory in shadir metadata
# and are defined here only for the sake of shadir compliance
json_metadata="{ \
\"server-group\": \"$SERVER_GROUP\", \
\"kernel-version\": \"$(version_to_list $(uname -v | cut -d' ' -f4))\", \
\"mca-version\": \"$(version_to_list $MCA_VERSION)\", \
\"flb-version\": \"$(version_to_list $FLB_VERSION)\", \
\"plg-version\": \"$(version_to_list $PLG_VERSION)\", \
\"timestamp\": $(date +%s), \
\"comment\": \"$hash_comment\", \
\"file\": \"notused\", \
\"urlmd5\": \"notused\" \
}"
echo "$json_metadata" > "$metadata_file"
networkcache-upload --conf ../tls-access-to-shacache/test.cfg --id river --file "$uefi_image_name" --metadata "$metadata_file"
echo $(sha512sum "$uefi_image_name" | cut -d' ' -f1) "$hash_comment" >> "$sha_list"
git add "$sha_list"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment