Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): add -q/--quiet optional argument #1638

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions nodebuilder
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
;;
Expand Down Expand Up @@ -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

Expand All @@ -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}'."
Expand All @@ -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
Expand Down
Loading