github.com/yimialmonte/fabric@v2.1.1+incompatible/integration/externalbuilders/golang/bin/detect (about)

     1  #!/bin/bash
     2  
     3  # Copyright IBM Corp. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  
     7  set -euo pipefail
     8  
     9  if [ "$#" -ne 2 ]; then
    10      >&2 echo "Expected 2 directories got $#"
    11      exit 2
    12  fi
    13  
    14  >&2 jq . "$2/metadata.json"
    15  
    16  if [ "$(jq -r .type "$2/metadata.json" | tr '[:upper:]' '[:lower:]')" != "golang" ]; then
    17      >&2 echo "only golang chaincode supported"
    18      exit 1
    19  fi
    20  
    21  if [[ "$(jq -r .label "$2/metadata.json")" != *-external* ]]; then
    22      >&2 echo "only golang chaincode named with an '-external' suffix is supported"
    23      exit 1
    24  fi
    25  
    26  exit 0