#!/usr/bin/env bash # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # fail if we encounter an error, uninitialized variable or a pipe breaks set -eu -o pipefail FC_TOOLS_DIR=$(dirname $(realpath $0)) source "$FC_TOOLS_DIR/functions" FC_ROOT_DIR=$FC_TOOLS_DIR/.. function get-profile-dir { case $1 in dev) echo debug ;; *) echo "$1" ;; esac } function check_swagger_artifact { # Validate swagger version against target version. local swagger_path version swagger_ver swagger_path=$1 version=$2 swagger_ver=$(get_swagger_version "$swagger_path") if [[ ! $version =~ v$swagger_ver.* ]]; then die "Artifact $swagger_path's version: $swagger_ver does not match release version $version." fi } function check_bin_artifact { # Validate binary version against target version. local bin_path version bin_version bin_path=$1 version=$2 bin_version=$($bin_path --version | head -1 | grep -oP ' \Kv.*') if [[ "$bin_version" != "$version" ]]; then die "Artifact $bin_path's version: $bin_version does not match release version $version." fi } function strip-and-split-debuginfo { local bin=$1 echo "STRIP $bin" objcopy --only-keep-debug $bin $bin.debug chmod a-x $bin.debug objcopy --strip-debug --add-gnu-debuglink=$bin.debug $bin } function get-firecracker-version { (cd src/firecracker; echo -n v; cargo pkgid | cut -d# -f2 | cut -d: -f2) } #### MAIN #### # defaults LIBC=musl PROFILE=dev MAKE_RELEASE= #### Option parsing while [[ $# -gt 0 ]]; do case $1 in --help) cat <SHA256SUMS )