Commit 627155f8 authored by Xiaowu Zhang's avatar Xiaowu Zhang

use version to handle

it's too complicated to manage with metadata version
let's just use version number
parent 50e6dba3
......@@ -18,19 +18,7 @@ git config --local user.name "Ophelie Gagnard"
apt -y install dracut-core dracut dracut-network sbsigntool pip
apt -y build-dep linux
apt -y install libncurses-dev
# the next line should be enabled when the following is merged and an egg containing the changes is released:
# https://lab.nexedi.com/nexedi/slapos.libnetworkcache/merge_requests/8
#pip install slapos.libnetworkcache
NC_BRANCH=cmdline-selection
NC_DIR="${NC_BRANCH}"_slapos.libnetworkcache
cd ..
if [ ! -d "$NC_DIR" ]; then
git clone https://lab.nexedi.com/Ophelie/slapos.libnetworkcache.git "$NC_DIR"
cd "$NC_DIR"
git checkout "$NC_BRANCH"
cd ..
pip install -e "$NC_DIR"
fi
pip install slapos.libnetworkcache
cd generation
rm -f *"$MCA_PACKAGE_NAME"*
rm -f *"$FLB_PACKAGE_NAME"*
......
......@@ -8,29 +8,9 @@ cd $GIT_ROOT
# define useful variables
source generation/00env.sh
SERVER_GROUP="${SERVER_GROUP:-generic}"
metadata_file=metadata.json
sha_list=installation/images-sha512.list
hash_comment="# debian-signed Debian kernel, network autoconfig off + dummy ips, rd.neednet=1 LABEL=Root, metadata in shadir, scan and send"
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"
}
# strings have to be quoted so that the file is decoded as valid json
json_metadata="{ \
\"server-group\": \"$SERVER_GROUP\", \
\"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\" \
}"
echo "$json_metadata" > "$metadata_file"
networkcache-upload --conf ../tls-access-to-shacache/test.cfg --key ocean.nexedi.com:river:debian:"$KERNEL_VERSION" --file "$UEFI_IMAGE_NAME" --metadata "$metadata_file"
networkcache-upload --conf ../tls-access-to-shacache/test.cfg --id ocean.nexedi.com:river:debian:"$KERNEL_VERSION" --file "$UEFI_IMAGE_NAME"
echo $(sha512sum "$UEFI_IMAGE_NAME" | cut -d' ' -f1) "$hash_comment" >> "$sha_list"
echo "$UEFI_IMAGE_NAME"
......
......@@ -50,7 +50,7 @@ RELATIVE_EFI_IMAGE_DIR=EFI/Linux
# NETWORKCACHE DOWNLOADING METHOD
tmp_image_name=image_tmp.efi
networkcache-download --config ../tls-access-to-shacache/test.cfg --key ocean.nexedi.com:river:debian:"$KERNEL_VERSION" "timestamp<<Infinity" > "$tmp_image_name"
networkcache-download --config ../tls-access-to-shacache/test.cfg --id ocean.nexedi.com:river:debian:"$KERNEL_VERSION" > "$tmp_image_name"
image_hash=$(sha512sum "$tmp_image_name" | cut -d' ' -f1)
mv "$tmp_image_name" "$image_hash"
echo image_hash = "$image_hash"
......
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