cic-staff-installer/setup_bloxberg.sh

49 lines
1.8 KiB
Bash
Raw Normal View History

2021-11-12 05:33:46 +01:00
. aux/bdbg/bdbg.sh
. setup_path.sh
2021-11-08 21:39:42 +01:00
GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum}
OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/parity}
openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)`
default_openethereum_run=$HOME/.local/share/io.parity.ethereum/bloxberg
2021-11-12 05:33:46 +01:00
default_openethereum_config=$HOME/.config/io.parity.ethereum/bloxberg
export OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run}
export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config}
2021-11-08 21:39:42 +01:00
install_env=
if [ ! -f $OPENETHEREUM_PATH ]; then
dbg $dbg_debug "downloading bloxberg node"
t=`mktemp -d`
pushd $t
install_env=1
git clone $GIT_OPENETHEREUM
cd openethereum
git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b
rustup install 1.47.0
cargo build --release --features final
2021-11-12 05:33:46 +01:00
cp -v $t/target/release/parity $HOME/.local/bin/
export OPENETHEREUM_PATH=$HOME/.local/bin/parity
2021-11-08 21:39:42 +01:00
else
dbg $dbg_info "found bloxberg node executable in $OPENETHEREUM_PATH"
fi
#OPENETHEREUM_RUN=$HOME/.local/share/bloxberg
2021-11-08 21:39:42 +01:00
if [ ! -d $OPENETHEREUM_RUN ]; then
mkdir -vp $OPENETHEREUM_RUN/bootnode
2021-11-12 05:33:46 +01:00
mkdir -vp $OPENETHEREUM_CONFIG
touch $OPENETHEREUM_CONFIG/bootnode.pwd
dd status=xfer if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"' > $OPENETHEREUM_CONFIG/bootnode.pwd
chmod -v 400 $OPENETHEREUM_CONFIG/bootnode.pwd
./aux/bash-templater/templater.sh var/bloxberg/bootnode.toml > $OPENETHEREUM_CONFIG/bootnode.toml
cp -v var/bloxberg/bloxberg.json $OPENETHEREUM_CONFIG/
cp -v var/bloxberg/bootnodes.txt $OPENETHEREUM_CONFIG/
cp -v systemd/bloxberg.service $HOME/.config/systemd/user/
./aux/bash-templater/templater.sh systemd/env/01-bloxberg.conf > $HOME/.config/environment.d/01-bloxberg.conf
systemctl --user daemon-reload
2021-11-08 21:39:42 +01:00
fi
2021-11-10 11:32:14 +01:00
update_path $openethereum_dir
2021-11-08 21:39:42 +01:00
if [ ! -z "$install_env" ]; then
popd
fi