More WIP on new installation scripts
This commit is contained in:
58
production/electrs-start-bitcoin
Executable file
58
production/electrs-start-bitcoin
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/local/bin/zsh
|
||||
|
||||
# TODO: add rust and llvm90 to installer pkg list if rpi4 arch detected
|
||||
# TODO: add network as argument
|
||||
# TODO: get env vars from global settings file for RPC, etc.
|
||||
# TODO: patch to disable compaction if settings wants that
|
||||
|
||||
# load rust cargo if installed from rustup
|
||||
if [ -f "${HOME}/.cargo/env" ];then
|
||||
source "${HOME}/.cargo/env"
|
||||
export PATH="${HOME}/.cargo/bin:${PATH}"
|
||||
fi
|
||||
|
||||
# detect architecture
|
||||
case `uname -m` in
|
||||
amd64)
|
||||
export TARGET=x86_64-unknown-freebsd
|
||||
;;
|
||||
|
||||
arm64)
|
||||
# need to compile rustc with target set for rpi4 etc.
|
||||
export TARGET=aarch64-unknown-freebsd
|
||||
|
||||
# NB: need to load libgcc_s.so from gcc9 instead of /lib !!
|
||||
export LD_LIBRARY_PATH=/usr/local/lib/gcc9
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown Architecture!"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# run electrs in a loop
|
||||
until false
|
||||
do
|
||||
# patch electrs source
|
||||
# if file exists and grep contains strings, patch it
|
||||
cd "${HOME}"/.cargo/registry/src/github.com-*/sysconf-0.3.*/
|
||||
patch -p1 < sysconf.patch
|
||||
|
||||
# go home
|
||||
cd "${HOME}/electrs"
|
||||
cargo run \
|
||||
--target "${TARGET}" \
|
||||
--release \
|
||||
--bin electrs \
|
||||
-- \
|
||||
-vvvv \
|
||||
--light-mode \
|
||||
--address-search \
|
||||
--db-dir /electrs \
|
||||
--daemon-dir "${HOME}" \
|
||||
--http-addr '[::]:3000' \
|
||||
--cookie "${BITCOIN_MAINNET_RPC_USER}:${BITCOIN_MAINNET_RPC_PASS}" \
|
||||
--precache-scripts "${HOME}/electrs/contrib/popular-scripts.txt"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user