Add version check before resuming from an old run
authorSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 12:28:07 +0000 (12:28 +0000)
committerSteve McIntyre <steve@einval.com>
Mon, 5 Mar 2018 12:28:07 +0000 (12:28 +0000)
Newer code stores data very differently, so it's not reasonable to
resume from an old interrupted rip run.

abcde

diff --git a/abcde b/abcde
index bf822c5..351c46e 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -2246,6 +2246,19 @@ do_discid ()
                        exit 1
                fi
                echo .
+               # Check to see the version of abcde that was used. If it's not
+               # the same version as we are, bail.
+               RESUME_VERSION="$(checkstatus abcde-version)"
+               if [ "$RESUME_VERSION" != "$VERSION" ]; then
+                       # Nope, complain and exit
+                       echo >&2
+                       echo "abcde: Working directory ${ABCDETEMPDIR} was created using version $RESUME_VERSION." >&2
+                       echo "abcde: Current version is $VERSION." >&2
+                       echo "abcde: Refusing to resume with a version mismatch." >&2
+                       echo "Please remove it, and rerun abcde." >&2
+                       exit 1
+               fi
+               echo .
                # See if it's populated
                if [ ! -f "${ABCDETEMPDIR}/cddbdiscid" ]; then
                        # Wipe and start fresh