Is there a way to tell what version we're upgrading from?

Is there a way to tell what version we’re upgrading from, in the post-refresh hook, a la SNAP_VERSION?

I need to tweak data in SNAP_DATA to accommodate structure changes in a newer version of my software, so I’d like to do something like:

if SNAP_VERSION_PREVIOUS < 1.2
    tweak

Matt

Unfortunately there’s nothing built-in, but you could do this easily yourself by having a pre-refresh hook which does:

#!/bin/sh 

echo "$SNAP_REVISION" > $SNAP_COMMON/old-revision

then your post-refresh hook could do:

#!/bin/sh

SNAP_OLD_REVISION=$(cat $SNAP_COMMON/old-revision)
# do things ...

Hi @mreimer this maybe sounds like a good use of epochs, btw:

Thanks guys, both approaches look interesting and should let me do what I need to do.

Matt