mirror of
https://git.proxmox.com/git/proxmox-kernel-helper
synced 2025-10-04 19:13:37 +00:00
proxmox-boot: add pin/unpin functionality for non-p-b-t systems
While running `update-grub` directly in this case is a divergence from the semantics of the command when p-b-t handles booting it makes the cleanup in the `next-boot` case a bit tidier. fetching the next-boot version explicitly again before setting the provided version is to cover the sequence: p-b-t kernel pin <ver1> --next-boot ; p-b-t kernel pin <ver2> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Tested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d5a182ad1d
commit
95c28bfa78
@ -437,15 +437,33 @@ pin_kernel() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "$ver" > "$pin_file"
|
echo "$ver" > "$pin_file"
|
||||||
echo "Set kernel '$ver' in $pin_file. Use the 'refresh' command to update the ESPs."
|
|
||||||
|
if [ -f "${ESP_LIST}" ]; then
|
||||||
|
echo "Set kernel '$ver' in $pin_file. Use the 'refresh' command to update the ESPs."
|
||||||
|
else
|
||||||
|
next_boot_ver=$(get_first_line "${NEXT_BOOT_PIN}")
|
||||||
|
pin_ver="${next_boot_ver:-$ver}"
|
||||||
|
echo "Setting '$pin_ver' as grub default entry and running update-grub."
|
||||||
|
set_grub_default "$pin_ver"
|
||||||
|
update-grub
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
unpin_kernel() {
|
unpin_kernel() {
|
||||||
rm -f "$NEXT_BOOT_PIN"
|
rm -f "$NEXT_BOOT_PIN"
|
||||||
echo "Removed $NEXT_BOOT_PIN. Use the 'refresh' command to update the ESPs."
|
echo "Removed $NEXT_BOOT_PIN."
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
rm -f "$PINNED_KERNEL_CONF"
|
rm -f "$PINNED_KERNEL_CONF"
|
||||||
echo "Removed $PINNED_KERNEL_CONF. Use the 'refresh' command to update the ESPs."
|
echo "Removed $PINNED_KERNEL_CONF."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${ESP_LIST}" ]; then
|
||||||
|
echo "Use the 'refresh' command to update the ESPs."
|
||||||
|
else
|
||||||
|
echo "Reset default grub entry and running update-grub."
|
||||||
|
pinned_kernel=$(get_first_line "${PINNED_KERNEL_CONF}")
|
||||||
|
set_grub_default "$pinned_kernel"
|
||||||
|
update-grub
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user