From 67bd472583704868f23478d46a5e8c4da4eea7f2 Mon Sep 17 00:00:00 2001 From: sc0vu Date: Tue, 5 Dec 2023 16:28:21 +0800 Subject: [PATCH] sh: update cleanup.sh --- testnet/local/cleanup.sh | 122 ++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/testnet/local/cleanup.sh b/testnet/local/cleanup.sh index a9a9c32..3665277 100644 --- a/testnet/local/cleanup.sh +++ b/testnet/local/cleanup.sh @@ -2,69 +2,71 @@ echo "Clean up data generated when execute scripts..." -NOW=$(TZ=UTC date +"%Y-%m-%dT%H:%M:%S.000000Z") -TITLE="\"genesis_time\"" +# NOW=$(TZ=UTC date +"%Y-%m-%dT%H:%M:%S.000000Z") +# TITLE="\"genesis_time\"" -clean_mix_dir () { - d=$1 - if [ -d $d ]; then - echo "Clean mix data: $d" - if [ -d $d/data ]; then - rm -rf $d/data/* - fi; - fi; -} +# clean_mix_dir () { +# d=$1 +# if [ -d $d ]; then +# echo "Clean mix data: $d" +# if [ -d $d/data ]; then +# rm -rf $d/data/* +# fi; +# fi; +# } -clean_provider_dir () { - d=$1 - if [ -d $d ]; then - echo "Clean provider data: $d" - if [ -d $d/data ]; then - rm -rf $d/data/* - fi; - if [ -f $d/cpu.prof ]; then - rm -rf $d/cpu.prof - fi; - if [ -f $d/mem.prof ]; then - rm -rf $d/mem.prof - fi; - fi; -} +# clean_provider_dir () { +# d=$1 +# if [ -d $d ]; then +# echo "Clean provider data: $d" +# if [ -d $d/data ]; then +# rm -rf $d/data/* +# fi; +# if [ -f $d/cpu.prof ]; then +# rm -rf $d/cpu.prof +# fi; +# if [ -f $d/mem.prof ]; then +# rm -rf $d/mem.prof +# fi; +# fi; +# } -clean_katzenmint_dir () { - d=$1 - if [ -d $d ]; then - echo "Clean katzenmint data: $d" - if [ ! -d $d/data ]; then - mkdir $d/data - fi; - if [ -d $d/data ]; then - rm -rf $d/data/* - fi; - if [ -d $d/kdata ]; then - rm -rf $d/kdata/* - fi; - if [ -d $d/katzenmint ]; then - rm -rf $d/katzenmint - fi; - if [ -d $d/config ]; then - rm -rf $d/config/write-file-atomic* - fi; - echo "{ - \"height\": \"0\", - \"round\": 0, - \"step\": 0 - }" > $d/data/priv_validator_state.json - # Update genesis block time - perl -i -pe"s/$TITLE.*/$TITLE: \"$NOW\",/g" $d/config/genesis.json - fi; -} +# clean_katzenmint_dir () { +# d=$1 +# if [ -d $d ]; then +# echo "Clean katzenmint data: $d" +# if [ ! -d $d/data ]; then +# mkdir $d/data +# fi; +# if [ -d $d/data ]; then +# rm -rf $d/data/* +# fi; +# if [ -d $d/kdata ]; then +# rm -rf $d/kdata/* +# fi; +# if [ -d $d/katzenmint ]; then +# rm -rf $d/katzenmint +# fi; +# if [ -d $d/config ]; then +# rm -rf $d/config/write-file-atomic* +# fi; +# echo "{ +# \"height\": \"0\", +# \"round\": 0, +# \"step\": 0 +# }" > $d/data/priv_validator_state.json +# # Update genesis block time +# perl -i -pe"s/$TITLE.*/$TITLE: \"$NOW\",/g" $d/config/genesis.json +# fi; +# } -for d in conf/* ; do - [ -L "${d%/}" ] && continue - [[ $d =~ ^conf/mix[1-3] ]] && clean_mix_dir $d - [[ $d =~ ^conf/provider[1-3] ]] && clean_provider_dir $d - [[ $d =~ ^conf/node[1-4] ]] && clean_katzenmint_dir $d -done +# for d in conf/* ; do +# [ -L "${d%/}" ] && continue +# [[ $d =~ ^conf/mix[1-3] ]] && clean_mix_dir $d +# [[ $d =~ ^conf/provider[1-3] ]] && clean_provider_dir $d +# [[ $d =~ ^conf/node[1-4] ]] && clean_katzenmint_dir $d +# done + +git checkout HEAD conf echo "Cleaned up!"