Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amtal/963550 to your computer and use it in GitHub Desktop.
Save amtal/963550 to your computer and use it in GitHub Desktop.
appups.sh
app="myapp"
function gen-ups {
rebar generate-appups previous_release=$1
cat $app/lib/*/ebin/*.appup
}
# This uses a dirty bunch of hacks to "generate" downgrade instructions
# (upgrade instructions in the opposite direction) with the current rebar
# version.
function main {
cp -r $app appup.$app.backup
rm -r $app/lib/*/ebin/*.appup
echo -e "\n UPGRADES:\n"
gen-ups $1
echo -e "\n DOWNGRADES:\n"
mv $app $app.appup.tmp
cp -r $1 $app
rm -r $app/lib/*/ebin/*.appup
gen-ups $app.appup.tmp
# get files into original state
rm -rf $app $app.appup.tmp
mv appup.$app.backup $app
}
main ${1:?"Usage: appups <prev_release_dir>"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment