don't warn about backup SHA1 when the providing package has changed
authorDennis Groenen <tj.groenen@gmail.com>
Tue, 16 Oct 2012 15:05:41 +0000 (17:05 +0200)
committerDennis Groenen <tj.groenen@gmail.com>
Tue, 16 Oct 2012 18:46:10 +0000 (20:46 +0200)
debian/scripts/functions
debian/scripts/install-binary.sh
debian/scripts/uninstall-binary.sh

index f5446f0..6d532b6 100644 (file)
@@ -52,3 +52,9 @@ CHECK_ROOT() {
       exit 1
     fi
 }
+
+# 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}'
+}
index 55ef026..27b66c5 100755 (executable)
@@ -52,6 +52,7 @@ BACKUP() {
       $EXECPWR cp -a /bin/busybox $DISTBIN
       $EXECPWR sha1sum $DISTBIN | $EXECPWR awk '{ print $1 }' \
         > $INSTALLDIR/busybox.distrib.sha1
+      GETBBVERSION > $INSTALLDIR/busybox.distrib.version
     fi
 }
 
index 205213a..c0c1496 100755 (executable)
@@ -46,7 +46,10 @@ 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
-        echo -e "Warning: the backed-up original binary has been modified since installing busybox-power (invalid SHA1 checksum). Do not continue unless you're sure $DISTBIN isn't corrupted.\n" >> /tmp/busybox-power-error
+        if test "`cat $INSTALLDIR/busybox.distrib.version`" == "`GETBBVERSION`"; then
+          # The backup has been changed whilst busybox hasn't been upgraded
+          echo -e "Warning: the backed-up original binary has been modified since installing busybox-power (invalid SHA1 checksum). Do not continue unless you're sure $DISTBIN isn't corrupted.\n" >> /tmp/busybox-power-error
+        fi
       fi
     else
       echo -e "Warning: couldn't load the saved SHA1 checksum of the original binary; the integrity of the backup of the original binary can not be guaranteed.\n" >> /tmp/busybox-power-error
@@ -145,6 +148,7 @@ UNSYMLINK() {
 # Action to be performed after restoring original busybox
 CLEANUP() {
     OLDFILES="busybox-power.symlinks
+      busybox.distrib.version
       busybox.distrib.sha1"
 
     for file in $OLDFILES; do