mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-06-12 11:27:01 +00:00
Update beta 1.2.2.2
This commit is contained in:
@@ -343,7 +343,7 @@ _bk_local() {
|
||||
# Fallback: gzip (rename archive)
|
||||
archive="${archive%.zst}"
|
||||
archive="${archive%.tar}.tar.gz"
|
||||
if command -v pv >/dev/null 2>&1; then
|
||||
if hb_ensure_pv; then
|
||||
local stage_bytes
|
||||
local pipefail_state
|
||||
stage_bytes=$(du -sb "$staging_root" 2>/dev/null | awk '{print $1}')
|
||||
@@ -1115,7 +1115,7 @@ _rs_export_to_file() {
|
||||
tar_ok=0
|
||||
: > "$log_file"
|
||||
|
||||
if command -v pv >/dev/null 2>&1; then
|
||||
if hb_ensure_pv; then
|
||||
# Stream tar through pv so the operator sees a live progress
|
||||
# bar instead of staring at a frozen title for minutes. We
|
||||
# mirror the same pattern used by the local backup path
|
||||
@@ -1132,10 +1132,11 @@ _rs_export_to_file() {
|
||||
fi
|
||||
[[ "$pipefail_state" == "off" ]] && set +o pipefail
|
||||
else
|
||||
# pv isn't installed — at least tell the operator something
|
||||
# is happening and hint at the package they can install for
|
||||
# a better experience next time.
|
||||
msg_info "$(translate "Creating export archive (install 'pv' for a live progress bar)...")"
|
||||
# Offline / apt unavailable — silently fall back to a plain
|
||||
# tar so we still produce the archive. No "install pv" message:
|
||||
# if we couldn't install it ourselves, sending the operator off
|
||||
# to apt is just shifting our problem onto them.
|
||||
msg_info "$(translate "Creating export archive...")"
|
||||
stop_spinner
|
||||
if tar -czf "$archive" -C "$staging_root" . >>"$log_file" 2>&1; then
|
||||
tar_ok=1
|
||||
|
||||
@@ -1889,6 +1889,18 @@ hb_require_cmd() {
|
||||
command -v "$cmd" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Silent best-effort install of `pv` so callers can pipe tar through it
|
||||
# for a live progress bar. Returns 0 if pv ends up available, 1 if not.
|
||||
# Never speaks — pv is purely an UX improvement, asking the operator to
|
||||
# install it themselves would be backwards (we have apt; they shouldn't).
|
||||
hb_ensure_pv() {
|
||||
command -v pv >/dev/null 2>&1 && return 0
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq pv >/dev/null 2>&1
|
||||
fi
|
||||
command -v pv >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# ==========================================================
|
||||
# Compatibility check — compares backup metadata against the
|
||||
# current host and surfaces hostname / PVE version / kernel /
|
||||
|
||||
Reference in New Issue
Block a user