summaryrefslogtreecommitdiffstats
path: root/src/import/import-tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/import-tar.c')
-rw-r--r--src/import/import-tar.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index 976c918246..e82159cb52 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -20,6 +20,7 @@
#include "machine-pool.h"
#include "mkdir-label.h"
#include "path-util.h"
+#include "pretty-print.h"
#include "process-util.h"
#include "qcow2-util.h"
#include "ratelimit.h"
@@ -150,7 +151,16 @@ static void tar_import_report_progress(TarImport *i) {
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
- log_info("Imported %u%%.", percent);
+
+ if (isatty_safe(STDERR_FILENO))
+ (void) draw_progress_barf(
+ percent,
+ "%s %s/%s",
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
+ FORMAT_BYTES(i->written_compressed),
+ FORMAT_BYTES(i->input_stat.st_size));
+ else
+ log_info("Imported %u%%.", percent);
i->last_percent = percent;
}
@@ -322,6 +332,9 @@ static int tar_import_process(TarImport *i) {
return 0;
finish:
+ if (r >= 0 && isatty_safe(STDERR_FILENO))
+ clear_progress_bar(/* prefix= */ NULL);
+
if (i->on_finished)
i->on_finished(i, r, i->userdata);
else