[pve-devel] [PATCH kernel-meta 09/10] efiboot: only keep last two series metapackages

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


namely, the current/latest and previous one, for which we also keep the
last kernel installed and synced.

the pipe to 'head' has the added bonus of guarding against 'grep'
returnin non-zero and triggering 'set -e'

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 efiboot/functions | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/efiboot/functions b/efiboot/functions
index 34a7042..8c473a4 100755
--- a/efiboot/functions
+++ b/efiboot/functions
@@ -41,9 +41,9 @@ kernel_keep_versions() {
 
 	latest_2_versions="$(echo "$sorted_list" | grep -E '^[^ ]+-pve' | head -n2 )"
 
-	series_metapackages="$(echo "$sorted_list" | grep -Ev '^[^ ]+-pve')"
+	series_metapackages="$(echo "$sorted_list" | grep -Ev '^[^ ]+-pve' | head -n2)"
 
-	oldseries="$(echo "$series_metapackages" | head -n2 | tail -n1)"
+	oldseries="$(echo "$series_metapackages" | tail -n1)"
 	oldseries_latest_kernel="$(echo "$sorted_list" | grep -E "^${oldseries}\.[^ ]+-pve" | head -n1 )"
 
 	if [ -e "$MANUAL_KERNEL_LIST" ]; then
-- 
2.20.1





More information about the pve-devel mailing list