From 2528a65e9f463ff787842c557f00a6889d1e4a14 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 1 Dec 2019 17:07:41 +0100 Subject: [PATCH] Take in a patch from dsa-nagios This is from this commit of the dsa-nagios.git. commit d95cb3856c48aff6792f8a6799fb1f37d44c4c51 Author: Peter Palfrader AuthorDate: Mon Oct 14 11:49:28 2019 +0200 Commit: Peter Palfrader CommitDate: Mon Oct 14 11:49:28 2019 +0200 dsa-check-running-kernel: sort kernel versions better When we ask apt-cache for information on the metapackage to extract the actual kernel image it depends on, we sort that output. It's not clear why we do that, since we pass the option --no-all-versions to apt-cache so we should only get one answer anyhow. Nevertheless, since we sort we might just as well use -V to version sort that output. dpkg-version sort would be even better, but hey. This is based on Erik Auerswald's patch in #884328. Signed-off-by: Mattia Rizzolo --- hosts/common/usr/local/bin/dsa-check-running-kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/common/usr/local/bin/dsa-check-running-kernel b/hosts/common/usr/local/bin/dsa-check-running-kernel index 0f410cfa..719bb2d6 100755 --- a/hosts/common/usr/local/bin/dsa-check-running-kernel +++ b/hosts/common/usr/local/bin/dsa-check-running-kernel @@ -94,7 +94,7 @@ get_avail() { local imagename=0 # --no-all-versions show shows only the candidate - for vers in $(apt-cache --no-all-versions show ${prefix}-image-${metavers} | sed -n 's/^Depends: //p' | tr ',' '\n' | tr -d ' ' | grep ${prefix}-image | awk '{print $1}' | awk -F"|" '{print $1}' | sort -u); do + for vers in $(apt-cache --no-all-versions show ${prefix}-image-${metavers} | sed -n 's/^Depends: //p' | tr ',' '\n' | tr -d ' ' | grep ${prefix}-image | awk '{print $1}' | awk -F"|" '{print $1}' | sort -Vu); do if dpkg --compare-versions "1.$vers" gt "1.$imagename"; then imagename=$vers fi -- GitLab