diff --git a/lib/functions/cli/cli-docker.sh b/lib/functions/cli/cli-docker.sh index 6733481508..eda84d32cb 100644 --- a/lib/functions/cli/cli-docker.sh +++ b/lib/functions/cli/cli-docker.sh @@ -25,7 +25,6 @@ function cli_docker_run() { ARMBIAN_CLI_RELAUNCH_PARAMS+=(["SET_OWNER_TO_UID"]="${EUID}") # fix the owner of files to our UID ARMBIAN_CLI_RELAUNCH_PARAMS+=(["ARMBIAN_BUILD_UUID"]="${ARMBIAN_BUILD_UUID}") # pass down our uuid to the docker instance ARMBIAN_CLI_RELAUNCH_PARAMS+=(["SKIP_LOG_ARCHIVE"]="yes") # launched docker instance will not cleanup logs. - declare -g SKIP_LOG_ARCHIVE=yes # Don't archive logs in the parent instance either. declare -g ARMBIAN_CLI_RELAUNCH_ARGS=() produce_relaunch_parameters # produces ARMBIAN_CLI_RELAUNCH_ARGS @@ -49,6 +48,7 @@ function cli_docker_run() { # Set globals to avoid: # 1) showing the controlling host's log; we only want to show a ref to the Docker logfile, unless it didn't produce one. + # If it did produce one, it's "link" is already shown above. if [[ $docker_produced_logs -gt 0 ]]; then declare -g show_message_after_export="skip" # handled by export_ansi_logs() fi diff --git a/lib/functions/logging/trap-logging.sh b/lib/functions/logging/trap-logging.sh index 8be303105d..3c099c2fcb 100644 --- a/lib/functions/logging/trap-logging.sh +++ b/lib/functions/logging/trap-logging.sh @@ -22,9 +22,18 @@ function trap_handler_cleanup_logging() { # Before writing new logfile, compress and move existing ones to archive folder. # - Unless running under CI. # - Also not if signalled via SKIP_LOG_ARCHIVE=yes + if [[ "${CI:-false}" != "true" && "${SKIP_LOG_ARCHIVE:-no}" != "yes" ]]; then - declare -a existing_log_files_array - mapfile -t existing_log_files_array < <(find "${target_path}" -maxdepth 1 -type f -name "armbian-*.*") + declare -a existing_log_files_array # array of existing log files: dash and dot in filename required. + mapfile -t existing_log_files_array < <(find "${target_path}" -maxdepth 1 -type f -name "*-*.*") + + # if more than 7 log files, warn user... + if [[ "${#existing_log_files_array[@]}" -gt 7 ]]; then + # Hey, I fixed Docker archiving, so this should not happen again... heh. + display_alert "Archiving" "${#existing_log_files_array[@]} old log files - be patient & thanks for testing armbian-next! 👍" "wrn" + wait_for_disk_sync # for dramatic effect + fi + declare one_old_logfile old_logfile_fn target_archive_path="${target_path}"/archive for one_old_logfile in "${existing_log_files_array[@]}"; do old_logfile_fn="$(basename "${one_old_logfile}")"