From c9e8214a9bf87f8d106f6e3730e2930b510f5468 Mon Sep 17 00:00:00 2001 From: Epic Curious <109078515+epiccurious@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:12:47 -0500 Subject: [PATCH] feat: Initial changes, no success yet --- nodebuilder | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nodebuilder b/nodebuilder index 62e0941..d2ca14a 100755 --- a/nodebuilder +++ b/nodebuilder @@ -18,7 +18,23 @@ gpg_signatures_file_source="${bitcoin_source}/${gpg_signatures_filename}" guix_sigs_repo="https://github.com/bitcoin-core/guix.sigs.git" tmp_dir="$(mktemp -d)" -trap 'rm -rf -- "$tmp_dir"' EXIT +trap cleanup EXIT +trap handle_sigint SIGINT +trap '' INT + +cleanup() { + echo "cleaning up" + rm -rf -- "${tmp_dir}" +} + +handle_sigint() { + sleep 10 + echo -e "\n\nALERT: Script interrupted with SIGINT (Ctrl+C)." + cleanup + #echo $(ps h -t $tty -o tpgid | uniq) + #kill -INT -$(ps h -t $tty -o tpgid | uniq) +} + bitcoin_tarball_temporary_file="${tmp_dir}/${bitcoin_tarball_filename}" bitcoin_tarball_destination_file="${HOME}/Downloads/${bitcoin_tarball_filename}" bitcoin_hash_file="${tmp_dir}/${bitcoin_hash_filename}" @@ -251,7 +267,7 @@ if [ "$(grep --count --ignore-case "^prune=" "${bitcoin_core_config_file}")" == fi echo -n "Starting Bitcoin Core... " -"${bitcoin_core_binary_dir}"/bitcoin-qt 2> /dev/null & +exec "${bitcoin_core_binary_dir}"/bitcoin-qt 2> /dev/null & disown "${bitcoin_core_binary_dir}"/bitcoin-cli --rpcwait getrpcinfo > /dev/null echo "ok."