cic-staff-installer/setup_bloxberg.sh

49 lines
1.4 KiB
Bash

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/bloxberg
OPENETHEREUM_RUN=${OPENETHEREUM_RUN:-$default_openethereum_run}
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
else
dbg $dbg_info "found bloxberg node executable in $OPENETHEREUM_PATH"
fi
OPENETHEREUM_RUN=$HOME/.local/share/bloxberg
if [ ! -d $OPENETHEREUM_RUN ]; then
mkdir -vp $OPENETHEREUM_RUN/bootnode
touch $OPENETHEREUM_RUN/bootnode.pwd
dd if=/dev/urandom bs=32 count=1 2> /dev/null | hexdump -v -n 32 -e '1/1 "%02x"' > $OPENETHEREUM_RUN/bootnode.pwd
chmod 400 $OPENETHEREUM_RUN/bootnode.pwd
fi
_IFS=$IFS
IFS=:
read -rapaths <<< "$PATH"
matchpath=
for f in ${paths[@]}; do
if [ "$f" == "$openethereum_dir" ]; then
matchpath=1
fi
done
if [ -z "$matchpath" ]; then
dbg dbg_info "Adding bloxberg executable path $openethereum_dir to \$PATH"
export PATH=$PATH:$openethereum_dir
echo "export PATH=\$PATH:$openethereum_dir" >> $HOME/.bashrc
fi
if [ ! -z "$install_env" ]; then
popd
fi