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.

Signed-off-by: Stoiko Ivanov <s.iva...@proxmox.com>
---
 bin/proxmox-boot-tool | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/bin/proxmox-boot-tool b/bin/proxmox-boot-tool
index 005109a..90ebfb2 100755
--- a/bin/proxmox-boot-tool
+++ b/bin/proxmox-boot-tool
@@ -415,12 +415,25 @@ pin_kernel() {
                exit 1
        fi
        echo "$ver" > "$PINNED_KERNEL_CONF"
-       echo "Set kernel '$ver' $PINNED_KERNEL_CONF. Use the 'refresh' command 
to update the ESPs."
+
+       if [ -f "${ESP_LIST}" ]; then
+               echo "Set kernel '$ver' $PINNED_KERNEL_CONF. Use the 'refresh' 
command to update the ESPs."
+       else
+               echo "Setting '$ver' as grub default entry and running 
update-grub."
+               set_grub_default "$ver"
+               update-grub
+       fi
 }
 
 unpin_kernel() {
        rm -f "$PINNED_KERNEL_CONF"
-       echo "Removed $PINNED_KERNEL_CONF. Use the 'refresh' command to update 
the ESPs."
+       if [ -f "${ESP_LIST}" ]; then
+               echo "Removed $PINNED_KERNEL_CONF. Use the 'refresh' command to 
update the ESPs."
+       else
+               echo "Reset default grub entry and running update-grub."
+               set_grub_default ""
+               update-grub
+       fi
 }
 
 if [ -z "$1" ]; then
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to