diff --git a/build/tasks/certs.js b/build/tasks/certs.js index fe486819d2..1c4317779b 100644 --- a/build/tasks/certs.js +++ b/build/tasks/certs.js @@ -31,8 +31,7 @@ gulp.task('get-crypto-binaries-amd64', shell.task( ); gulp.task('get-crypto-binaries-mac', shell.task( - 'mkdir -p ' + binariesPath + ';' + - 'wget ' + darwinBinaries + ' -P ' + binariesPath + ';' + + 'curl --create-dirs --output ' + binariesPath + '/' + darwinTarFile + ' ' + darwinBinaries + ';' + 'tar xvzf ' + binariesPath + '/' + darwinTarFile + ' -C ' + binariesPath + ';') ); diff --git a/test/fixtures/crypto-material/config-base/generate.sh b/test/fixtures/crypto-material/config-base/generate.sh index 82426e99d6..b53f490f0d 100755 --- a/test/fixtures/crypto-material/config-base/generate.sh +++ b/test/fixtures/crypto-material/config-base/generate.sh @@ -4,34 +4,34 @@ # # Set the path to teh crypto material to ensure it may be used -CRYPTOGEN=$1 -export PATH=${PATH}:${CRYPTOGEN} +CRYPTOGEN="$1" +export PATH="${PATH}:${CRYPTOGEN}" # Get current location to ensure things go to the correct place -BASEDIR=$(dirname $(realpath $0)) +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Start generating echo "Creating new crypto material and tx blocks from within directory ${BASEDIR}" -rm -rf ${BASEDIR}/../crypto-config -rm -rf ${BASEDIR}/../channel-config -mkdir ${BASEDIR}/../crypto-config -mkdir ${BASEDIR}/../channel-config +rm -rf "${BASEDIR}/../crypto-config" +rm -rf "${BASEDIR}/../channel-config" +mkdir "${BASEDIR}/../crypto-config" +mkdir "${BASEDIR}/../channel-config" echo 'Generating base crypto-material and channel tx files....' -export FABRIC_CFG_PATH=${BASEDIR} -cryptogen generate --config=${BASEDIR}/crypto-config.yaml --output=${BASEDIR}/../crypto-config -configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ${BASEDIR}/twoorgs.genesis.block -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/mychannel.tx -channelID mychannel -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/mychannel2.tx -channelID mychannel2 #test/integration/network-config.js -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/mychanneltx.tx -channelID mychanneltx #test/integration/create-configtx-channel.js -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/mychannelts.tx -channelID mychannelts #test/typescript -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/adminconfig.tx -channelID adminconfig #test/only-admin.js -configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ${BASEDIR}/../channel-config/discovery.tx -channelID discovery #test/integration/discovery.js +export FABRIC_CFG_PATH="${BASEDIR}" +cryptogen generate --config="${BASEDIR}/crypto-config.yaml" --output="${BASEDIR}/../crypto-config" +configtxgen -profile TwoOrgsOrdererGenesis -outputBlock "${BASEDIR}/twoorgs.genesis.block" +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/mychannel.tx" -channelID mychannel +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/mychannel2.tx" -channelID mychannel2 #test/integration/network-config.js +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/mychanneltx.tx" -channelID mychanneltx #test/integration/create-configtx-channel.js +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/mychannelts.tx" -channelID mychannelts #test/typescript +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/adminconfig.tx" -channelID adminconfig #test/only-admin.js +configtxgen -profile TwoOrgsChannel -outputCreateChannelTx "${BASEDIR}/../channel-config/discovery.tx" -channelID discovery #test/integration/discovery.js echo 'Generating crypto-material complete, now renaming keys...' # Rename the key files we use to be key.pem instead of a uuid -for KEY in $(find ${BASEDIR}/../crypto-config -type f -name "*_sk"); do - KEY_DIR=$(dirname ${KEY}) - mv ${KEY} ${KEY_DIR}/key.pem +for KEY in $(find "${BASEDIR}/../crypto-config" -type f -name "*_sk"); do + KEY_DIR="$(dirname ${KEY})" + mv ${KEY} "${KEY_DIR}/key.pem" done echo 'Renaming keys complete' diff --git a/test/fixtures/crypto-material/config-update/generate.sh b/test/fixtures/crypto-material/config-update/generate.sh index 8b05ddce7c..e463ac08c3 100755 --- a/test/fixtures/crypto-material/config-update/generate.sh +++ b/test/fixtures/crypto-material/config-update/generate.sh @@ -4,15 +4,15 @@ # # Set the path to teh crypto material to ensure it may be used -CRYPTOGEN=$1 -export PATH=${PATH}:${CRYPTOGEN} +CRYPTOGEN="$1" +export PATH="${PATH}:${CRYPTOGEN}" # Get current location to ensure things go to the correct place -BASEDIR=$(dirname $(realpath $0)) +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo echo "Creating new channel update tx blocks from within directory ${BASEDIR}" -export FABRIC_CFG_PATH=$BASEDIR -configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ${BASEDIR}/../channel-config/mychannel-org1anchor.tx -channelID mychannel -asOrg Org1MSP -configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ${BASEDIR}/../channel-config/discovery_anchor.tx -channelID discovery -asOrg Org1MSP +export FABRIC_CFG_PATH="$BASEDIR" +configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate "${BASEDIR}/../channel-config/mychannel-org1anchor.tx" -channelID mychannel -asOrg Org1MSP +configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate "${BASEDIR}/../channel-config/discovery_anchor.tx" -channelID discovery -asOrg Org1MSP diff --git a/test/fixtures/crypto-material/generateAll.sh b/test/fixtures/crypto-material/generateAll.sh index a199606c45..1d5f1d6c6e 100755 --- a/test/fixtures/crypto-material/generateAll.sh +++ b/test/fixtures/crypto-material/generateAll.sh @@ -6,8 +6,8 @@ CRYPTOGEN=$1 echo '' echo "Crypto-gen scripts running based on binaries location ${CRYPTOGEN}" -BASEDIR=$(dirname $(realpath $0)) -${BASEDIR}/config-base/generate.sh ${CRYPTOGEN} -${BASEDIR}/config-update/generate.sh ${CRYPTOGEN} +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +"${BASEDIR}/config-base/generate.sh" ${CRYPTOGEN} +"${BASEDIR}/config-update/generate.sh" ${CRYPTOGEN} echo '' diff --git a/test/fixtures/fabricca/generateCSR.sh b/test/fixtures/fabricca/generateCSR.sh index 456ecbbb31..2bc3f872a9 100755 --- a/test/fixtures/fabricca/generateCSR.sh +++ b/test/fixtures/fabricca/generateCSR.sh @@ -1,6 +1,10 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 +# -BASEDIR=$(dirname $(realpath $0)) +BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "Generating fabricca cetificates and keys in directory ${BASEDIR}" -openssl req -nodes -newkey rsa:2048 -keyout ${BASEDIR}/test.key -out ${BASEDIR}/test.csr -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=aTestUser" -openssl req -nodes -newkey rsa:512 -keyout ${BASEDIR}/enroll-key.pem -out ${BASEDIR}/enroll-csr.pem -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=testUser" +openssl req -nodes -newkey rsa:2048 -keyout "${BASEDIR}/test.key" -out "${BASEDIR}/test.csr" -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=aTestUser" +openssl req -nodes -newkey rsa:512 -keyout "${BASEDIR}/enroll-key.pem" -out "${BASEDIR}/enroll-csr.pem" -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=testUser" echo "Generation complete"