27 lines
553 B
Bash
27 lines
553 B
Bash
#!/bin/bash
|
|
|
|
# Copyright IBM Corp. All Rights Reserved.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -ne 2 ]; then
|
|
>&2 echo "Expected 2 directories got $#"
|
|
exit 2
|
|
fi
|
|
|
|
>&2 jq . "$2/metadata.json"
|
|
|
|
if [ "$(jq -r .type "$2/metadata.json" | tr '[:upper:]' '[:lower:]')" != "golang" ]; then
|
|
>&2 echo "only golang chaincode supported"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$(jq -r .label "$2/metadata.json")" != *-external* ]]; then
|
|
>&2 echo "only golang chaincode named with an '-external' suffix is supported"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|