From 4bae57d994ac229591bb3036baae01000dafb693 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 9 Nov 2021 08:34:02 -0500 Subject: [PATCH] Fix preflight printing to log --- setup/so-preflight | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/setup/so-preflight b/setup/so-preflight index c0e2db135..756c721dc 100755 --- a/setup/so-preflight +++ b/setup/so-preflight @@ -28,10 +28,19 @@ fi check_default_repos() { local ret_code=0 + local repo_str=' Checking OS default repos with ' + if [[ $script_run == true ]]; then + printf '%s' "$repo_str" + else + printf '%s' "$repo_str" | tee -a "$preflight_log" + fi - printf ' Checking OS default repos with ' | tee -a "$preflight_log" if [[ $OS == 'centos' ]]; then - printf '%s' 'yum update.' | tee -a "$preflight_log" + if [[ $script_run == true ]]; then + printf '%s' 'yum update.' + else + printf '%s' 'yum update.' | tee -a "$preflight_log" + fi echo "" >> "$preflight_log" yum -y check-update >> $preflight_log 2>&1 ret_code=$? @@ -42,7 +51,11 @@ check_default_repos() { printf '%s\n' ' FAILURE' fi else - printf '%s' 'apt update.' | tee -a "$preflight_log" + if [[ $script_run == true ]]; then + printf '%s' 'apt update.' + else + printf '%s' 'apt update.' | tee -a "$preflight_log" + fi echo "" >> "$preflight_log" retry 50 10 "apt-get -y update" >> $preflight_log 2>&1 ret_code=$? @@ -54,7 +67,12 @@ check_default_repos() { } check_new_repos() { - printf ' Checking repo URLs added by setup.' | tee -a "$preflight_log" + local repo_url_str=' Checking repo URLs added by setup.' + if [[ $script_run == true ]]; then + printf '%s' "$repo_url_str" + else + printf '%s' "$repo_url_str" | tee -a "$preflight_log" + fi if [[ $OS == 'centos' ]]; then local repo_arr=( @@ -83,7 +101,12 @@ check_new_repos() { } check_misc_urls() { - printf ' Checking various other URLs used by setup.' | tee -a "$preflight_log" + local misc_url_str=' Checking various other URLs used by setup.' + if [[ $script_run == true ]]; then + printf '%s' "$misc_url_str" + else + printf '%s' "$misc_url_str" | tee -a "$preflight_log" + fi local so_version so_version=$(cat ../VERSION)