2021-03-19 15:19:40 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
2021-10-14 11:33:50 +02:00
|
|
|
. ./util.sh
|
|
|
|
|
|
|
|
set -a
|
|
|
|
DEV_DEBUG_FLAG=""
|
2021-10-19 22:08:17 +02:00
|
|
|
DEV_DEBUG_LEVEL=${DEV_DEBUG_LEVEL:-0}
|
|
|
|
if [ "$DEV_DEBUG_LEVEL" -eq 1 ]; then
|
2021-10-14 11:33:50 +02:00
|
|
|
DEV_DEBUG_FLAG="-v"
|
2021-10-19 22:08:17 +02:00
|
|
|
elif [ "$DEV_DEBUG_LEVEL" -gt 1 ]; then
|
2021-10-14 11:33:50 +02:00
|
|
|
DEV_DEBUG_FLAG="-vv"
|
|
|
|
fi
|
|
|
|
|
2021-10-25 20:09:35 +02:00
|
|
|
DEV_WAIT_FLAG=""
|
|
|
|
if [ ! -z "$DEV_TX_WAIT" ]; then
|
|
|
|
DEV_WAIT_FLAG="-w"
|
|
|
|
fi
|
|
|
|
|
2021-10-14 11:33:50 +02:00
|
|
|
# disable override of config schema directory
|
|
|
|
unset CONFINI_DIR
|
|
|
|
|
|
|
|
set +a
|
|
|
|
|
2021-10-17 18:05:00 +02:00
|
|
|
LAST_BIT_POS=5
|
|
|
|
files=(deploy_contract_root deploy_contract_instance deploy_token init_custodial data_seeding)
|
|
|
|
description=("global contracts" "instance specific contracts" "token deployment" "initialize custodial engine" "data seeding for development")
|
2021-10-14 11:33:50 +02:00
|
|
|
|
|
|
|
>&2 echo -e "\033[;96mRUNNING configurations\033[;39m"
|
|
|
|
source ./config.sh
|
2021-09-06 12:06:58 +02:00
|
|
|
if [ $? -ne "0" ]; then
|
2021-10-14 11:33:50 +02:00
|
|
|
>&2 echo -e "\033[;31mFAILED configurations\033[;39m"
|
2021-09-06 12:06:58 +02:00
|
|
|
exit 1;
|
|
|
|
fi
|
2021-10-14 11:33:50 +02:00
|
|
|
>&2 echo -e "\033[;32mSUCCEEDED configurations\033[;39m"
|
|
|
|
|
|
|
|
>&2 echo -e "\033[;96mInitial configuration state\033[;39m"
|
|
|
|
|
|
|
|
confini-dump --schema-dir ./config
|
2021-03-19 15:19:40 +01:00
|
|
|
|
2021-10-14 11:33:50 +02:00
|
|
|
clear_pending_tx_hashes
|
|
|
|
|
2021-10-19 22:08:17 +02:00
|
|
|
RUN_MASK_HIGHEST=0
|
|
|
|
for ((i=$LAST_BIT_POS; i>0; i--)); do
|
|
|
|
b=$((2**$((i-1))))
|
|
|
|
if [ $((b & $RUN_MASK)) -gt 0 ]; then
|
|
|
|
RUN_MASK_HIGHEST=$i
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2021-10-14 11:33:50 +02:00
|
|
|
|
|
|
|
bit=1
|
|
|
|
for ((i=0; i<$LAST_BIT_POS; i++)); do
|
|
|
|
runlevel="RUNLEVEL $bit"
|
|
|
|
if [[ $((RUN_MASK & $bit)) -eq ${bit} ]]; then
|
|
|
|
s="$runlevel - ${description[$i]}"
|
|
|
|
>&2 echo -e "\033[;96mRUNNING $s\033[;39m"
|
|
|
|
source $((i+1))_${files[$i]}.sh
|
|
|
|
if [ $? -ne "0" ]; then
|
|
|
|
>&2 echo -e "\033[;31mFAILED $s\033[;39m"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
>&2 echo -e "\033[;32mSUCCEEDED $s\033[;39m"
|
2021-10-14 21:31:04 +02:00
|
|
|
>&2 echo -e "\033[;96mConfiguration state after $runlevel execution\033[;39m"
|
2021-10-14 11:33:50 +02:00
|
|
|
confini-dump --schema-dir ./config
|
2021-07-05 12:58:08 +02:00
|
|
|
fi
|
2021-10-14 11:33:50 +02:00
|
|
|
bit=$((bit*2))
|
|
|
|
done
|