]> git.proxmox.com Git - pve-kernel-meta.git/commitdiff
efiboot: only keep last two series metapackages
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 12 Jul 2019 13:16:50 +0000 (15:16 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 15 Jul 2019 12:28:21 +0000 (14:28 +0200)
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@proxmox.com>
efiboot/functions

index 34a70426f8a0a2a1fa3d3fe336e1a0e15d384326..8c473a4f8194ea0ff7f68f3af2e0f9a620cfe930 100755 (executable)
@@ -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