[pve-devel] [PATCH kernel-meta 06/10] pve-efiboot-tool: add 'kernels list' subcommand

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jul 12 15:16:47 CEST 2019


to list custom and automatically selected kernel versions that are synced to configured ESPs

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 bin/pve-efiboot-tool | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/bin/pve-efiboot-tool b/bin/pve-efiboot-tool
index 5c51cc0..704b28a 100755
--- a/bin/pve-efiboot-tool
+++ b/bin/pve-efiboot-tool
@@ -234,6 +234,25 @@ remove_kernel() {
 	fi
 }
 
+list_kernels() {
+	boot_kernels="$(boot_kernel_list)"
+
+	if [ -e "$MANUAL_KERNEL_LIST" ]; then
+		manual_kernels="$(echo "$boot_kernels" | grep -Fx -f "$MANUAL_KERNEL_LIST")"
+		boot_kernels="$(echo "$boot_kernels" | grep -Fxv -f "$MANUAL_KERNEL_LIST")"
+	fi
+
+	if [ -z "$manual_kernels" ]; then
+		manual_kernels="None."
+	fi
+
+	echo "Manually selected kernels:"
+	echo "$manual_kernels"
+	echo ""
+	echo "Automatically selected kernels:"
+	echo "$boot_kernels"
+}
+
 usage() {
 	warn "USAGE: $0 <commands> [ARGS]"
 	warn ""
@@ -242,6 +261,7 @@ usage() {
 	warn "       $0 clean [--dry-run]"
 	warn "       $0 refresh"
 	warn "       $0 kernels <add|remove> <kernel-version>"
+	warn "       $0 kernels list"
 	warn "       $0 help"
 }
 
@@ -266,6 +286,10 @@ help() {
 	echo ""
 	echo "    add/remove pve-kernel with ABI <kernel-version> to list of synced kernels, in addition to automatically selected ones."
 	echo ""
+	echo "USAGE: $0 kernels list"
+	echo ""
+	echo "    list kernel versions currently selected for inclusion on ESPs."
+	echo ""
 }
 
 if [ -z "$1" ]; then
@@ -325,6 +349,10 @@ case "$1" in
 				remove_kernel "$2"
 				exit 0
 			;;
+			'list')
+				list_kernels
+				exit 0
+			;;
 			*)
 				warn "E: invalid subcommand '$cmd'."
 				warn ""
-- 
2.20.1





More information about the pve-devel mailing list