Skip to content

Commit

Permalink
make pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
linj-disanbo committed Feb 23, 2024
1 parent ab0843a commit f98a088
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BUILD_FLAGS := -ldflags '-X "github.com/assetcloud/plugin/version.GitCommit=$(Gi
MKPATH=$(abspath $(lastword $(MAKEFILE_LIST)))
MKDIR=$(dir $(MKPATH))
proj := "build"
.PHONY: default dep all build release cli linter race test fmt vet bench msan coverage coverhtml docker docker-compose protobuf clean help autotest
.PHONY: default dep all build release cli linter race test fmt vet bench msan coverage coverhtml docker docker-compose protobuf clean help autotest pkg

default: depends build

Expand All @@ -37,6 +37,11 @@ build_ci: depends ## Build the binary file for CI
@cp chain.toml build/
@cp chain.para.toml build/ci/paracross/

pkg:
rm assetchain-qbft assetchain-qbft.tgz -rf
mkdir assetchain-qbft
cp build/chain build/chain-cli chain.para.toml genconfig.sh assetchain-qbft
tar zcfv assetchain-qbft.tgz assetchain-qbft

PLATFORM_LIST = \
darwin-amd64 \
Expand Down
64 changes: 64 additions & 0 deletions genconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

set -x
config="chain.para.toml"

function genConfig() {
echo -e "start auto modify config"

peerArray=$1
num=$2

validatorNodes=""
seeds=""
for((i=0;i<$num;i++));
do
validatorNodes=${validatorNodes},\""${peerArray[$i]}:33001"\"
seeds=${seeds},"\"${peerArray[$i]}:13801\""
done
validatorNodes=$(echo $validatorNodes|sed '/^,/s///g')
seeds=$(echo $seeds|sed '/^,/s///g')

sed -i "s/^validatorNodes=.*/validatorNodes=[${validatorNodes}]/g" ${config}
sed -i "s/^seeds=.*/seeds=[${seeds}]/g" ${config}
for((i=0;i<$num;i++));
do
rm -rf ${peerArray[$i]}
mkdir -p ${peerArray[$i]}
cp ${config} ${peerArray[$i]}/${config}
done

}

function prepareChainPkg() {
echo -e "start prepare chain33 files"

peerArray=$1
num=$2

./chain-cli qbft gen_file -n $num -t bls

for((i=0;i<$num;i++));
do
cp priv_validator_$i.json ${peerArray[$i]}/priv_validator.json
cp genesis_file.json ${peerArray[$i]}/genesis.json
cp chain ${peerArray[$i]}/chain
cp chain-cli ${peerArray[$i]}/chain-cli
done

}

function main() {
peers=$1

peerArray=(${peers//,/ })

peerNum=${#peerArray[*]}

genConfig $peerArray $peerNum

prepareChainPkg $peerArray $peerNum
}

main $1

0 comments on commit f98a088

Please sign in to comment.