diff --git a/nodebuilder b/nodebuilder index 9b7347a9e..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 @@ -1339,14 +1339,18 @@ log_error() log_info() { - printf '[%s] INFO: %s\n' "$(get_log_timestamp)" "$*" + if [ "${quiet_output}" = '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_output}" = 'false' ]; then + printf "[%s] DONE: ${CONSOLE_COLOR_GREEN:-}%s" "$(get_log_timestamp)" "$*" + reset_console_color + printf '\n' + fi } log_warning() @@ -1364,6 +1368,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' @@ -1470,6 +1475,7 @@ target_bitcoin_version='28.0' compile_bitcoin_flag='false' prune_value='-1' +quiet_output='false' skip_system_update='false' skip_system_update_reboot='false' unattended='false' @@ -1511,6 +1517,9 @@ while [ $# -gt 0 ]; do prune_value="$2" shift ;; + -q | --quiet) + quiet_output='true' + ;; -r | --skip-reboot) skip_system_update_reboot='true' ;; @@ -1587,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 @@ -1608,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}'." @@ -1623,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