[pve-devel] [PATCH pve-kernel-meta 5/5] proxmox-boot: add pin/unpin functionality for non-p-b-t systems

Stoiko Ivanov s.ivanov at proxmox.com
Mon Jan 31 18:59:18 CET 2022


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.ivanov at 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





More information about the pve-devel mailing list