mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Convert all scripts into a basic bash cli
This commit is contained in:
parent
1a5118de49
commit
4617325367
27 changed files with 77 additions and 8 deletions
|
|
@ -1,2 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
./build/bin/geth --identity "ShyftTestnetNode" --keystore ./ --datadir "./shyftData" init ShyftNetwork.json
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd ./shyft-cli/postgres_setup
|
||||||
psql -U postgres -d shyftdb -f drop_tables.psql
|
psql -U postgres -d shyftdb -f drop_tables.psql
|
||||||
|
|
@ -1 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd ./shyft-cli/postgres_setup
|
||||||
psql -U postgres -d shyftdb -f create_tables.psql
|
psql -U postgres -d shyftdb -f create_tables.psql
|
||||||
4
shyft-cli/postgres_setup/initdb.sh
Normal file
4
shyft-cli/postgres_setup/initdb.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd ./shyft-cli/postgres_setup
|
||||||
|
psql -U postgres -f create_shyftdb.psql
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
file=$1
|
file=$1
|
||||||
echo $file
|
echo Executing "${file}"...
|
||||||
runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545"
|
runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545"
|
||||||
eval $runthing
|
eval $runthing
|
||||||
17
shyft-cli/setup.sh
Normal file
17
shyft-cli/setup.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then # Check if db is instantiated
|
||||||
|
echo Creating postgres db...
|
||||||
|
sh ./shyft-cli/postgres_setup/initdb.sh && # Init DB
|
||||||
|
echo Successfully created postgres db! &&
|
||||||
|
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||||
|
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||||
|
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||||
|
else
|
||||||
|
echo Postgres DB found!
|
||||||
|
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
|
||||||
|
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||||
|
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||||
|
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||||
|
fi
|
||||||
|
|
||||||
12
shyft-cli/shyftFullReset.sh
Normal file
12
shyft-cli/shyftFullReset.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! psql -lqt | cut -d \| -f 1 | grep -qw shyftdb; then
|
||||||
|
echo Creating postgres db...
|
||||||
|
sh ./shyft-cli/postgres_setup/initdb.sh &&
|
||||||
|
echo Successfully created postgres db!
|
||||||
|
fi
|
||||||
|
|
||||||
|
sh ./shyft-cli/postgres_setup/drop_tables.sh && # Drop tables
|
||||||
|
sh ./shyft-cli/postgres_setup/init_tables.sh && # Init tables
|
||||||
|
sh ./shyft-cli/resetShyftGeth.sh && # Reset geth data
|
||||||
|
sh ./shyft-cli/initShyftGeth.sh # Init Shyft Geth
|
||||||
36
shyft-geth.sh
Executable file
36
shyft-geth.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
illegalCommands=()
|
||||||
|
while [[ $# -gt 0 ]]
|
||||||
|
do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
--setup)
|
||||||
|
sh ./shyft-cli/setup.sh
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
--start)
|
||||||
|
sh ./shyft-cli/startShyftGeth.sh
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
--js)
|
||||||
|
sh ./shyft-cli/runJs.sh ./shyft-cli/web3/$2
|
||||||
|
shift # past argument
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
--reset)
|
||||||
|
sh ./shyft-cli/shyftFullReset.sh
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
*) # unknown option
|
||||||
|
illegalCommands+=("$1") # save it in an array for later
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${#illegalCommands[@]}" -gt "0" ]] ; then
|
||||||
|
echo The following commands are not supported: "${illegalCommands[*]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
psql -U postgres -f create_shyftdb.psql
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
cd ./shyftDb/postgres_setup
|
|
||||||
sh drop_tables.sh && sh init_tables.sh
|
|
||||||
cd ..
|
|
||||||
cd ..
|
|
||||||
sh resetShyftGeth.sh && sh initShyftGeth.sh
|
|
||||||
Loading…
Reference in a new issue