update 1.2.2.2 beta

This commit is contained in:
MacRimi
2026-07-04 21:37:39 +02:00
parent 29ebfdc324
commit 66dd3ec014
66 changed files with 6114 additions and 83 deletions

View File

@@ -157,7 +157,7 @@ _bk_pbs() {
# that case the blob does not describe this snapshot and
# uploading it as a paired recovery would be misleading.
# This runs as a SEPARATE backup group
# (`host/proxmenux-keyrecovery-<host>`) with NO --keyfile,
# (`host/hostcfg-<host>-keyrecovery`) with NO --keyfile,
# so PBS stores it as a plain (non-PBS-encrypted) blob that
# can be retrieved during fresh-install recovery. The blob
# is still passphrase-protected by openssl.
@@ -841,7 +841,13 @@ _rs_extract_pbs() {
proxmox-backup-client snapshot list \
--repository "$HB_PBS_REPOSITORY" \
--output-format json 2>/dev/null \
| jq -r '.[] | select(."backup-type" == "host" and ((."backup-id" | startswith("proxmenux-keyrecovery-")) | not)) | "\(."backup-type")|\(."backup-id")|\(."backup-time")"' 2>/dev/null \
| jq -r '.[]
| select(."backup-type" == "host"
and not (
(."backup-id" | startswith("proxmenux-keyrecovery-"))
or ((."backup-id" | startswith("hostcfg-")) and (."backup-id" | endswith("-keyrecovery")))
))
| "\(."backup-type")|\(."backup-id")|\(."backup-time")"' 2>/dev/null \
| while IFS='|' read -r _type _id _epoch; do
local _iso
_iso=$(date -u -d "@${_epoch}" '+%Y-%m-%dT%H:%M:%SZ' 2>/dev/null \

View File

@@ -304,7 +304,7 @@ _create_job_attached() {
_create_job() {
local id backend on_calendar profile_mode
id=$(dialog --backtitle "ProxMenux" --title "$(translate "New backup job")" \
--inputbox "$(translate "Job ID (letters, numbers, - _)")" 9 68 "hostcfg-daily" 3>&1 1>&2 2>&3) || return 1
--inputbox "$(translate "Job ID (letters, numbers, - _)")" 9 68 "my-host-backup" 3>&1 1>&2 2>&3) || return 1
[[ -z "$id" ]] && return 1
id=$(echo "$id" | tr -cs '[:alnum:]_-' '-' | sed 's/^-*//; s/-*$//')
[[ -z "$id" ]] && return 1

View File

@@ -331,21 +331,75 @@ _sb_run_pbs() {
# without the keyfile, which is the whole point of the escrow.
local recovery_enc="/usr/local/share/proxmenux/pbs-key.recovery.enc"
if [[ -n "${PBS_KEYFILE:-}" && -f "$recovery_enc" ]]; then
local keyrec_id
keyrec_id="hostcfg-$(hostname)-keyrecovery"
env PBS_PASSWORD="$PBS_PASSWORD" \
PBS_FINGERPRINT="${PBS_FINGERPRINT:-}" \
proxmox-backup-client backup \
"keyrecovery.conf:${recovery_enc}" \
--repository "$PBS_REPOSITORY" \
--backup-type host \
--backup-id "proxmenux-keyrecovery-$(hostname)" \
--backup-id "$keyrec_id" \
--backup-time "$epoch" \
2>&1 || true
# Prune the paired keyrecovery group with the SAME retention
# values as the main backup. Without this the keyrecovery snapshots
# accumulate one per run while the main group is pruned to keep-*,
# cluttering the datastore over time. Any single keyrecovery snapshot
# is sufficient to reconstruct the keyfile — but matching retention
# keeps the two groups aligned in count and makes cleanup obvious.
env PBS_PASSWORD="$PBS_PASSWORD" \
PBS_FINGERPRINT="${PBS_FINGERPRINT:-}" \
proxmox-backup-client prune "host/${keyrec_id}" --repository "$PBS_REPOSITORY" \
${KEEP_LAST:+--keep-last "$KEEP_LAST"} \
${KEEP_HOURLY:+--keep-hourly "$KEEP_HOURLY"} \
${KEEP_DAILY:+--keep-daily "$KEEP_DAILY"} \
${KEEP_WEEKLY:+--keep-weekly "$KEEP_WEEKLY"} \
${KEEP_MONTHLY:+--keep-monthly "$KEEP_MONTHLY"} \
${KEEP_YEARLY:+--keep-yearly "$KEEP_YEARLY"} \
2>&1 || true
fi
echo "PBS_SNAPSHOT=host/${backup_id}/${epoch}"
return 0
}
# For attached jobs, re-read the parent vzdump job's prune-backups
# live from /etc/pve/jobs.cfg every run and rewrite KEEP_*. The .env
# only carries a snapshot of the parent's retention at creation time,
# so if the parent later gained (or changed) prune-backups the child
# would silently accumulate. Attached mode is authoritative from the
# parent by design — that's the whole point of "attached".
_sb_hydrate_attached_retention() {
local parent="${PVE_PARENT_JOB:-}"
[[ -z "$parent" ]] && return 0
local cfg=/etc/pve/jobs.cfg
[[ -f "$cfg" ]] || return 0
local prune
prune=$(awk -v pid="$parent" '
/^vzdump:[[:space:]]/ { in_block=($2==pid); next }
/^[a-z]+:/ { in_block=0; next }
in_block && /^[[:space:]]+prune-backups[[:space:]]/ {
sub(/^[[:space:]]+prune-backups[[:space:]]+/, "");
print; exit
}
' "$cfg")
# Clear any KEEP_* the .env may have — those are the create-time
# snapshot and are now stale. If the parent later removed prune-
# backups altogether, this correctly stops pruning the child too.
unset KEEP_LAST KEEP_HOURLY KEEP_DAILY KEEP_WEEKLY KEEP_MONTHLY KEEP_YEARLY
[[ -z "$prune" ]] && return 0
local kv
while IFS= read -r kv; do
[[ -n "$kv" ]] && export "${kv?}"
done < <(hb_pve_prune_to_keep_env "$prune")
}
main() {
local job_id="${1:-}"
[[ -z "$job_id" ]] && { echo "Usage: $0 <job_id>" >&2; exit 1; }
@@ -356,6 +410,11 @@ main() {
# shellcheck source=/dev/null
source "$job_file"
# Attached jobs: re-read retention from the PVE parent live (see
# _sb_hydrate_attached_retention above for the why). Standalone
# jobs keep whatever KEEP_* the .env has.
_sb_hydrate_attached_retention
local lock_file="${LOCK_DIR}/proxmenux-backup-${job_id}.lock"
if command -v flock >/dev/null 2>&1; then
exec 9>"$lock_file" || exit 1

View File

@@ -62,8 +62,7 @@
"root_fs": { "enum": ["ext4", "xfs", "btrfs", "zfs"] },
"cpu_model": { "type": "string" },
"cpu_arch": { "enum": ["x86_64", "aarch64"] },
"memory_kb": { "type": "integer", "minimum": 0 },
"subscription_status": { "type": ["string", "null"] }
"memory_kb": { "type": "integer", "minimum": 0 }
}
},