From 566538c36715e67ca1e1a2df08164ffa61fdbb70 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 28 Apr 2010 10:05:15 +0200 Subject: [PATCH] Teach dsa-check-running-kernel about LZMA compressed kernel images. --- dsa-nagios-checks/checks/dsa-check-running-kernel | 11 ++++++++++- dsa-nagios-checks/debian/changelog | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dsa-nagios-checks/checks/dsa-check-running-kernel b/dsa-nagios-checks/checks/dsa-check-running-kernel index df78397..b386774 100755 --- a/dsa-nagios-checks/checks/dsa-check-running-kernel +++ b/dsa-nagios-checks/checks/dsa-check-running-kernel @@ -5,6 +5,7 @@ # Copyright 2008,2009 Peter Palfrader # Copyright 2009 Stephen Gran +# Copyright 2010 Uli Martens # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -118,12 +119,13 @@ get_avail() { } get_image() { - local image GZHDR1 GZHDR2 off + local image GZHDR1 GZHDR2 LZHDR off image="$1" GZHDR1="\x1f\x8b\x08\x00" GZHDR2="\x1f\x8b\x08\x08" + LZHDR="\x00\x00\x00\x02\xff" off=`get_offset "$image" $GZHDR1` [ "$?" != "0" ] && off="-1" @@ -139,6 +141,13 @@ get_image() { return fi + off=`get_offset "$image" $LZHDR` + [ "$?" != "0" ] && off="-1" + if [ "$off" -ne "-1" ]; then + (dd ibs="$[off-1]" skip=1 count=0 && dd bs=512k) < "$image" 2>/dev/null | lzcat 2>/dev/null + return + fi + echo "ERROR: Unable to extract kernel image." 2>&1 exit 1 } diff --git a/dsa-nagios-checks/debian/changelog b/dsa-nagios-checks/debian/changelog index 9be3b49..e1975e8 100644 --- a/dsa-nagios-checks/debian/changelog +++ b/dsa-nagios-checks/debian/changelog @@ -7,7 +7,10 @@ dsa-nagios-checks (8X) Xnstable; urgency=low [ Stephen Gran ] * Add dsa-check-uptime - -- Stephen Gran Fri, 02 Apr 2010 16:55:51 +0100 + [ Uli Martens ] + * Teach dsa-check-running-kernel about LZMA compressed kernel images. + + -- Peter Palfrader Wed, 28 Apr 2010 10:04:37 +0200 dsa-nagios-checks (85) unstable; urgency=low -- 2.20.1