From f401fb3a2c91b74e43c214667750941ae95e89be Mon Sep 17 00:00:00 2001 From: Dennis Groenen Date: Tue, 16 Oct 2012 20:51:20 +0200 Subject: [PATCH] add check for missing busybox.distrib.version in prerm --- debian/busybox-power.prerm | 19 ++++++++++++++----- debian/scripts/functions | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/debian/busybox-power.prerm b/debian/busybox-power.prerm index 005916b..e7314d5 100644 --- a/debian/busybox-power.prerm +++ b/debian/busybox-power.prerm @@ -46,12 +46,21 @@ CHECK_BACKUP() { # Secondly, check the integrity of the backup if test -e $INSTALLDIR/busybox.distrib.sha1; then if test "`cat $INSTALLDIR/busybox.distrib.sha1`" != "$ORIGBINARY_SHA1"; then - if test "`cat $INSTALLDIR/busybox.distrib.version`" == "`GETBBVERSION`"; then - # The backup has been changed whilst busybox hasn't been upgraded + if test -e $INSTALLDIR/busybox.distrib.version; then + if test "`cat $INSTALLDIR/busybox.distrib.version`" == "`GETBBVERSION`"; then + # The backup has been changed whilst busybox hasn't been upgraded + echo -e "Warning: the backup of the original BusyBox binary has" \ + "been modified since installing busybox-power (invalid SHA1" \ + "checksum). Do not continue unless you're sure that $DISTBIN" \ + "is not corrupted.\n" >> /tmp/busybox-power-error + fi + else echo -e "Warning: the backup of the original BusyBox binary has" \ - "been modified since installing busybox-power (invalid SHA1" \ - "checksum). Do not continue unless you're sure that $DISTBIN" \ - "is not corrupted.\n" >> /tmp/busybox-power-error + "been modified since installing busybox-power (invalid SHA1" \ + "checksum). We could not determine whether this is due to a BusyBox" \ + "upgrade (e.g. by an (C)SSU update) or not. Do not continue unless" \ + "either the latter is the case, or you're via other ways sure that" \ + "$DISTBIN is not corrupted.\n" >> /tmp/busybox-power-error fi fi else diff --git a/debian/scripts/functions b/debian/scripts/functions index 436b277..13031d3 100644 --- a/debian/scripts/functions +++ b/debian/scripts/functions @@ -42,5 +42,5 @@ CHECK_ROOT() { # Get the version string of the package providing /bin/busybox GETBBVERSION() { # XXX We assume the package "busybox" provides /bin/busybox - /usr/bin/dpkg -s busybox | awk '/^Version:/ {print $2}' + /usr/bin/dpkg -s busybox | $EXECPWR awk '/^Version:/ {print $2}' } -- 1.7.9.5