From 3109b37bfc6dd3c40f2e896ddb74d2f9d46a4ae7 Mon Sep 17 00:00:00 2001 From: Bitcoin Tools <156422466+bitcoin-tools@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:42:01 -0400 Subject: [PATCH 1/5] feat(ui): add `-q/--quiet` optional argument --- nodebuilder | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/nodebuilder b/nodebuilder index b87abc20b..ac118f11d 100755 --- a/nodebuilder +++ b/nodebuilder @@ -1268,14 +1268,18 @@ log_error() log_info() { - printf '[%s] INFO: %s\n' "$(get_log_timestamp)" "$*" + if [ "${quiet_mode}" = 'false' ]; then + printf '[%s] INFO: %s\n' "$(get_log_timestamp)" "$*" + fi } log_success() { - printf "[%s] DONE: ${CONSOLE_COLOR_GREEN:-}%s" "$(get_log_timestamp)" "$*" - reset_console_color - printf '\n' + if [ "${quiet_mode}" = 'false' ]; then + printf "[%s] DONE: ${CONSOLE_COLOR_GREEN:-}%s" "$(get_log_timestamp)" "$*" + reset_console_color + printf '\n' + fi } log_warning() @@ -1293,6 +1297,7 @@ print_usage() printf '%s\n' '-c, --compile Build Bitcoin from source' printf '%s\n' '-h, --help Display this help message' printf '%s\n' '-p, --prune Set a prune value in MiB' + printf '%s\n' '-q, --quiet Suppress standard output' printf '%s\n' '-r, --skip-reboot Skip reboot on system updates' printf '%s\n' '-s, --skip-update Skip install of system updates' printf '%s\n' '-t, --test Run unit tests on functions' @@ -1399,6 +1404,7 @@ target_bitcoin_version='27.1' compile_bitcoin_flag='false' prune_value='-1' +quiet_output='false' skip_system_update='false' skip_system_update_reboot='false' unattended='false' @@ -1440,6 +1446,8 @@ while [ $# -gt 0 ]; do prune_value="$2" shift ;; + -q | --quiet) + quiet_output='true' -r | --skip-reboot) skip_system_update_reboot='true' ;; From 89d1c8d927cb0b0cf1d06df36800fa1ae9a045ee Mon Sep 17 00:00:00 2001 From: Bitcoin Tools <156422466+bitcoin-tools@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:59:14 -0400 Subject: [PATCH 2/5] Update nodebuilder --- nodebuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/nodebuilder b/nodebuilder index ac118f11d..b5c8f28d8 100755 --- a/nodebuilder +++ b/nodebuilder @@ -1448,6 +1448,7 @@ while [ $# -gt 0 ]; do ;; -q | --quiet) quiet_output='true' + ;; -r | --skip-reboot) skip_system_update_reboot='true' ;; From 37432f29cb9314d7d485012d3e0a797f0b583d1f Mon Sep 17 00:00:00 2001 From: Bitcoin Tools <156422466+bitcoin-tools@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:46:37 -0400 Subject: [PATCH 3/5] Update nodebuilder --- nodebuilder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodebuilder b/nodebuilder index b5c8f28d8..635fce477 100755 --- a/nodebuilder +++ b/nodebuilder @@ -1268,14 +1268,14 @@ log_error() log_info() { - if [ "${quiet_mode}" = 'false' ]; then + if [ "${quiet_output}" = 'false' ]; then printf '[%s] INFO: %s\n' "$(get_log_timestamp)" "$*" fi } log_success() { - if [ "${quiet_mode}" = 'false' ]; then + if [ "${quiet_output}" = 'false' ]; then printf "[%s] DONE: ${CONSOLE_COLOR_GREEN:-}%s" "$(get_log_timestamp)" "$*" reset_console_color printf '\n' From d04538d0e2db49bd7fd62efe07cb48a9032662fb Mon Sep 17 00:00:00 2001 From: Bitcoin Tools <156422466+bitcoin-tools@users.noreply.github.com> Date: Fri, 11 Oct 2024 07:32:29 -0400 Subject: [PATCH 4/5] improve quiet mode stdout suppression --- nodebuilder | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodebuilder b/nodebuilder index b359cbc50..7552df794 100755 --- a/nodebuilder +++ b/nodebuilder @@ -1596,7 +1596,7 @@ if is_running_in_ci || sudo --validate --noninteractive > /dev/null 2>&1; then : else - printf '%s\n' 'Please enter your password to log in, if requested.' + log_info 'Please enter your password to log in, if requested.' sudo --validate fi @@ -1617,9 +1617,11 @@ case "${TARGET_KERNEL}" in ;; Darwin) log_info 'Detected: running macOS.' - [ "${TARGET_ARCHITECTURE}" = 'arm64' ] && display_macos_warning TARGET_BITCOIN_TARBALL_OS='apple-darwin' BITCOIN_DATA_DIRECTORY="${HOME}/Library/Application Support/Bitcoin" + if [ "${TARGET_ARCHITECTURE}" = 'arm64' ] && [ "${quiet_output}" = 'false' ]; then + display_macos_warning + fi ;; *) throw_error "Unknown target kernel type '${TARGET_KERNEL}'." @@ -1632,10 +1634,12 @@ readonly BITCOIN_CORE_CONFIG_FILE="${BITCOIN_DATA_DIRECTORY}/bitcoin.conf" readonly BITCOIN_CORE_DEBUG_LOG_FILE="${BITCOIN_DATA_DIRECTORY}/debug.log" check_internet_status + [ "${skip_system_update:-false}" = 'true' ] || [ "${TARGET_KERNEL}" = 'Darwin' ] || is_running_in_ci || install_system_updates + install_runtime_dependencies if command -v bitcoind > /dev/null 2>&1; then From 922dab29669cfe601556ca61be9c25a6aad33181 Mon Sep 17 00:00:00 2001 From: Bitcoin Tools <156422466+bitcoin-tools@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:34:31 -0400 Subject: [PATCH 5/5] don't clear the terminal with -q --- nodebuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodebuilder b/nodebuilder index 7552df794..1b269e958 100755 --- a/nodebuilder +++ b/nodebuilder @@ -38,7 +38,7 @@ check_internet_to_address() clear_the_terminal() { - if is_running_in_ci || is_running_in_container; then + if [ "${quiet_output}" = 'true' ] || is_running_in_ci || is_running_in_container; then return elif [ ! -t 1 ]; then # stdout is not a terminal perhaps redirected or piped