add check for missing busybox.distrib.version in prerm
authorDennis Groenen <tj.groenen@gmail.com>
Tue, 16 Oct 2012 18:51:20 +0000 (20:51 +0200)
committerDennis Groenen <tj.groenen@gmail.com>
Wed, 17 Oct 2012 19:12:32 +0000 (21:12 +0200)
debian/busybox-power.prerm
debian/scripts/functions

index 005916b..e7314d5 100644 (file)
@@ -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
index 436b277..13031d3 100644 (file)
@@ -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}'
 }