From 2d7389fb024a28313245fbfc1abf4ea1c62aa637 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 12 Jul 2019 15:16:47 +0200 Subject: [PATCH] pve-efiboot-tool: add 'kernels list' subcommand MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit to list custom and automatically selected kernel versions that are synced to configured ESPs Signed-off-by: Fabian Grünbichler --- 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 [ARGS]" warn "" @@ -242,6 +261,7 @@ usage() { warn " $0 clean [--dry-run]" warn " $0 refresh" warn " $0 kernels " + warn " $0 kernels list" warn " $0 help" } @@ -266,6 +286,10 @@ help() { echo "" echo " add/remove pve-kernel with ABI 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.39.2