From 76ecff816998464a5906c383071f6312773bbacf Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 26 Jun 2013 10:58:04 -0400 Subject: [PATCH] fix(bootstrap_sdk): Rename final output tarball The name "coreos-sdk-amd64-..." makes much more sense for general distribution than "stage4..." so after catalyst is done rename the final tarball and fixup the DIGESTS file to refer to the new name. --- bootstrap_sdk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bootstrap_sdk b/bootstrap_sdk index 5f20dd929b..d064457e49 100755 --- a/bootstrap_sdk +++ b/bootstrap_sdk @@ -52,3 +52,26 @@ catalyst_stage_default catalyst_init "$@" catalyst_build + +info "Build complete! Changing output name to something more sensible." +build_name="stage4-${ARCH}-${FLAGS_version}.tar.bz2" +release_name="${TYPE}-${ARCH}-${FLAGS_version}.tar.bz2" +ln -f "$BUILDS/${build_name}" "$BUILDS/${release_name}" +ln -f "$BUILDS/${build_name}.CONTENTS" "$BUILDS/${release_name}.CONTENTS" +sed -e "s/${build_name}/${release_name}/" \ + "$BUILDS/${build_name}.DIGESTS" > "$BUILDS/${release_name}.DIGESTS" + +# Validate we didn't break the DIGESTS with sed +for hash_type in md5 sha1 sha512; do + info "Validating ${hash_type} DIGESTS" + # shash is what's used to generate these multi-hash digests but it + # doesn't exit with non-zero on failure. I mean seriously... + #shash -c "$BUILDS/${release_name}.DIGESTS" -a "${hash_type}" + # So we do it the hard way... + grep -qi "^# ${hash_type} HASH$" "$BUILDS/${release_name}.DIGESTS" + (cd "$BUILDS" && grep -A1 -i "^# ${hash_type} HASH$" \ + "${release_name}.DIGESTS" | grep -v '^--$' | \ + ${hash_type}sum -c - --strict) +done + +info "SDK ready: $BUILDS/${release_name}"