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.iva...@proxmox.com> --- bin/proxmox-boot-tool | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool index 90c4f5d..178b6fb 100755 --- a/bin/proxmox-boot-tool +++ b/bin/proxmox-boot-tool @@ -437,15 +437,33 @@ pin_kernel() { exit 1 fi 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() { 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 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 } -- 2.30.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel