mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
This change makes the way the type property is extracted from the metadata.json file much more robust, and therefore sets a better example. Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
14 lines
359 B
Bash
Executable file
14 lines
359 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -euo pipefail
|
|
|
|
METADIR=$2
|
|
# check if the "type" field is set to "external"
|
|
# crude way without jq which is not in the default fabric peer image
|
|
TYPE=$(tr -d '\n' < "$METADIR/metadata.json" | awk -F':' '{ for (i = 1; i < NF; i++){ if ($i~/type/) { print $(i+1); break }}}'| cut -d\" -f2)
|
|
|
|
if [ "$TYPE" = "external" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
exit 1
|