Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for binaries on system #59

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions fabric/startDev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,45 @@ download_binaries(){
rm install-fabric.sh
}

FILE=bin
if [ ! -d "$FILE" ]; then
echo "Directory $FILE not found"
download_binaries
# Check PATH
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Binaries to check
fabric_binaries=("fabric-ca-client" "fabric-ca-server" "osnadmin" "configtxgen" "configtxlator" "cryptogen" "discover" "orderer" "peer")

all_binaries_exist() {
for binary in "${fabric_binaries[@]}"; do
if ! command_exists "$binary"; then
return 1
fi
done
return 0
}

if all_binaries_exist; then
echo "All Fabric binaries are available in the system path."
else
cd bin;
numFiles="$(ls -1 | wc -l)"
if [ "$numFiles" -ne 10 ];
then
cd ..
echo "Missing some fabric binaries"
echo "Some or all Fabric binaries are missing from the system path."

FILE=bin
if [ ! -d "$FILE" ]; then
echo "Directory $FILE not found"
download_binaries
else
cd ..
echo "Bin directory already exists"
cd bin
numFiles="$(ls -1 | wc -l)"
if [ "$numFiles" -ne 10 ]; then
cd ..
echo "Missing some fabric binaries in bin directory"
download_binaries
else
cd ..
fi
fi
fi
fi

docker network create cc-tools-demo-net
./network.sh up createChannel -n $ORG_QNTY
Expand Down
Loading