mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-08-02 05:46:21 +00:00
update 1.2.2.2 beta
This commit is contained in:
@@ -40,9 +40,8 @@ fi
|
||||
|
||||
: "${HB_RESTORE_INCLUDE_ZFS:=0}"
|
||||
: "${HB_COMPAT_CROSS_VERSION:=0}"
|
||||
: "${HB_KERNEL_PIN_ACTION:=none}"
|
||||
: "${HB_KERNEL_PIN_KVER:=}"
|
||||
: "${HB_KERNEL_PIN_PKG:=}"
|
||||
: "${HB_COMPAT_KERNEL_DIRECTION:=same}"
|
||||
: "${HB_HYDRATION_APPLIED:=0}"
|
||||
|
||||
if [[ ! -f "$APPLY_LIST" ]]; then
|
||||
echo "Apply list missing: $APPLY_LIST"
|
||||
@@ -50,13 +49,11 @@ if [[ ! -f "$APPLY_LIST" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Pending dir: $PENDING_DIR"
|
||||
echo "Apply list: $APPLY_LIST"
|
||||
echo "Include ZFS: $HB_RESTORE_INCLUDE_ZFS"
|
||||
echo "Cross-version: $HB_COMPAT_CROSS_VERSION"
|
||||
echo "Kernel pin act: $HB_KERNEL_PIN_ACTION"
|
||||
echo "Kernel pin ver: $HB_KERNEL_PIN_KVER"
|
||||
echo "Kernel pin pkg: $HB_KERNEL_PIN_PKG"
|
||||
echo "Pending dir: $PENDING_DIR"
|
||||
echo "Apply list: $APPLY_LIST"
|
||||
echo "Include ZFS: $HB_RESTORE_INCLUDE_ZFS"
|
||||
echo "Cross-version: $HB_COMPAT_CROSS_VERSION"
|
||||
echo "Kernel direction: $HB_COMPAT_KERNEL_DIRECTION"
|
||||
|
||||
# Hardware-drift skips persisted by _rs_prepare_pending_restore.
|
||||
# Each line is an absolute path; we drop any rel path that matches
|
||||
@@ -268,6 +265,16 @@ EOF
|
||||
NEEDS_GRUB=1 ;;
|
||||
esac
|
||||
done < "$APPLY_LIST"
|
||||
# bk_older hydration writes tokens/modules/files DIRECTLY to
|
||||
# the live target (bypassing the apply_list because the whole
|
||||
# paths are in RS_SKIP_PATHS). Those changes still need
|
||||
# update-initramfs + update-grub / proxmox-boot-tool refresh
|
||||
# to take effect on the next boot — force the flags so the
|
||||
# post-boot script picks them up.
|
||||
if [[ "${HB_HYDRATION_APPLIED:-0}" == "1" ]]; then
|
||||
NEEDS_INITRAMFS=1
|
||||
NEEDS_GRUB=1
|
||||
fi
|
||||
echo "Post-boot maintenance flags: initramfs=$NEEDS_INITRAMFS grub=$NEEDS_GRUB"
|
||||
|
||||
# Marker as env-style key=value so the post-boot script
|
||||
@@ -310,60 +317,6 @@ UNITEOF
|
||||
systemctl daemon-reload >/dev/null 2>&1 || true
|
||||
systemctl enable proxmenux-apply-cluster-postboot.service >/dev/null 2>&1 || true
|
||||
|
||||
# ── Cross-kernel: install (if needed) + pin backup's kernel ──
|
||||
# When the backup was taken on a different kernel major.minor
|
||||
# than the target, the restore flow pre-computed a plan telling
|
||||
# us whether the backup's kernel is already on the target or
|
||||
# can be pulled from Proxmox repos. Acting here — during the
|
||||
# onboot restore, before the cluster-postboot fires — gives us
|
||||
# a controlled reboot into the pinned kernel, so the DKMS
|
||||
# auto-reinstall in postboot builds every module against the
|
||||
# right ABI (the kernel the operator's backup actually expects).
|
||||
_kernel_pin_reboot_needed=0
|
||||
if [[ "$HB_KERNEL_PIN_ACTION" != "none" && -n "$HB_KERNEL_PIN_KVER" ]]; then
|
||||
echo ""
|
||||
echo "── Cross-kernel: preparing kernel $HB_KERNEL_PIN_KVER ──"
|
||||
if [[ "$HB_KERNEL_PIN_ACTION" == "installable" ]]; then
|
||||
echo "Installing $HB_KERNEL_PIN_PKG from Proxmox repositories..."
|
||||
apt-get update -qq 2>&1 | tail -5
|
||||
if DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$HB_KERNEL_PIN_PKG" 2>&1 | tail -10; then
|
||||
echo " ✓ $HB_KERNEL_PIN_PKG installed"
|
||||
else
|
||||
echo " ✗ apt install failed — pin will fall back to whatever kernels are present"
|
||||
fi
|
||||
fi
|
||||
if command -v proxmox-boot-tool >/dev/null 2>&1; then
|
||||
proxmox-boot-tool kernel pin "$HB_KERNEL_PIN_KVER" 2>&1 | sed 's/^/ pin: /'
|
||||
proxmox-boot-tool refresh 2>&1 | sed 's/^/ refresh: /'
|
||||
_kernel_pin_reboot_needed=1
|
||||
else
|
||||
echo " ! proxmox-boot-tool not available — kernel pin skipped"
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( _kernel_pin_reboot_needed == 1 )); then
|
||||
# Do NOT start the cluster-postboot service in this boot.
|
||||
# We must reboot first so the kernel pin takes effect;
|
||||
# once the machine is back up on the pinned kernel, the
|
||||
# postboot service (enabled with a ConditionPathExists on
|
||||
# cluster-apply-pending) will fire automatically and its
|
||||
# DKMS reinstalls will target the correct kernel.
|
||||
echo ""
|
||||
echo "Rebooting into pinned kernel $HB_KERNEL_PIN_KVER..."
|
||||
echo "completed" >"$STATE_FILE" 2>/dev/null || true
|
||||
# Mark this restore as completed so the on-boot service
|
||||
# doesn't re-fire after we reboot.
|
||||
_rid="$(basename "$PENDING_DIR")"
|
||||
mv "$PENDING_DIR" "${PENDING_BASE}/completed/${_rid}" >/dev/null 2>&1 || true
|
||||
rm -f "$CURRENT_LINK" >/dev/null 2>&1 || true
|
||||
systemctl disable proxmenux-restore-onboot.service >/dev/null 2>&1 || true
|
||||
systemctl daemon-reload >/dev/null 2>&1 || true
|
||||
sync
|
||||
systemctl --no-block reboot
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Same-kernel path: fire cluster-postboot inline in this boot.
|
||||
# `systemctl enable` only adds the unit to multi-user.target.wants/.
|
||||
# It does NOT pull the unit into the currently-running boot
|
||||
# transaction — by the time we run, multi-user.target may have
|
||||
|
||||
Reference in New Issue
Block a user