#include "copy.h"
#include "export-raw.h"
#include "fd-util.h"
+#include "format-util.h"
#include "fs-util.h"
#include "import-common.h"
#include "missing_fcntl.h"
+#include "pretty-print.h"
#include "ratelimit.h"
#include "stat-util.h"
#include "string-util.h"
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
- log_info("Exported %u%%.", percent);
+
+ if (isatty_safe(STDERR_FILENO)) {
+ _cleanup_free_ char *s = NULL;
+
+ if (asprintf(&s, "%s %s/%s",
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
+ FORMAT_BYTES(e->written_uncompressed),
+ FORMAT_BYTES(e->st.st_size)) < 0)
+ return;
+
+ draw_progress_bar(s, percent);
+ } else
+ log_info("Exported %u%%.", percent);
e->last_percent = percent;
}
finish:
if (r >= 0) {
+ if (isatty_safe(STDERR_FILENO))
+ clear_progress_bar(/* prefix= */ NULL);
+
(void) copy_times(e->input_fd, e->output_fd, COPY_CRTIME);
(void) copy_xattr(e->input_fd, NULL, e->output_fd, NULL, 0);
}
#include "export-tar.h"
#include "fd-util.h"
#include "import-common.h"
+#include "pretty-print.h"
#include "process-util.h"
#include "ratelimit.h"
#include "string-util.h"
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
- log_info("Exported %u%%.", percent);
+
+ if (isatty_safe(STDERR_FILENO)) {
+ _cleanup_free_ char *s = NULL;
+
+ if (asprintf(&s, "%s %s/%s",
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
+ FORMAT_BYTES(e->written_uncompressed),
+ FORMAT_BYTES(e->quota_referenced)) < 0)
+ return;
+
+ draw_progress_bar(s, percent);
+ } else
+ log_info("Exported %u%%.", percent);
e->last_percent = percent;
}
return 0;
finish:
+ if (r >= 0 && isatty_safe(STDERR_FILENO))
+ clear_progress_bar(/* prefix= */ NULL);
+
if (e->on_finished)
e->on_finished(e, r, e->userdata);
else
#include "machine-pool.h"
#include "mkdir-label.h"
#include "path-util.h"
+#include "pretty-print.h"
#include "qcow2-util.h"
#include "ratelimit.h"
#include "rm-rf.h"
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
- log_info("Imported %u%%.", percent);
+
+ if (isatty_safe(STDERR_FILENO)) {
+ _cleanup_free_ char *s = NULL;
+
+ if (asprintf(&s, "%s %s/%s",
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
+ FORMAT_BYTES(i->written_compressed),
+ FORMAT_BYTES(i->input_stat.st_size)) < 0)
+ return;
+
+ draw_progress_bar(s, percent);
+ } else
+ log_info("Imported %u%%.", percent);
i->last_percent = percent;
}
return 0;
complete:
+ if (isatty_safe(STDERR_FILENO))
+ clear_progress_bar(/* prefix= */ NULL);
+
r = raw_import_finish(i);
finish:
#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"
return;
sd_notifyf(false, "X_IMPORT_PROGRESS=%u%%", percent);
- log_info("Imported %u%%.", percent);
+
+ if (isatty_safe(STDERR_FILENO)) {
+ _cleanup_free_ char *s = NULL;
+
+ if (asprintf(&s, "%s %s/%s",
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
+ FORMAT_BYTES(i->written_compressed),
+ FORMAT_BYTES(i->input_stat.st_size)) < 0)
+ return;
+
+ draw_progress_bar(s, percent);
+ } else
+ log_info("Imported %u%%.", percent);
i->last_percent = percent;
}
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