Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save josteinaj/df3119cd5eeb102a8a03 to your computer and use it in GitHub Desktop.
Save josteinaj/df3119cd5eeb102a8a03 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
SNAPSHOTS="https://dl.dropboxusercontent.com/u/6370535/nordic-epub3-dtbook-migrator"
INSTALLED="`ls ~/daisy-pipeline/modules/ | grep nordic-epub3-dtbook-migrator | grep jar$`"
CURRENT="`curl $SNAPSHOTS/current.txt`"
if [ "$?" -ne "0" ]; then
echo "Could not retrieve filename of current version of the Nordic EPUB3/DTBook Migrator"
elif [ "$CURRENT" = "$INSTALLED" ]; then
echo "Most recent version of Nordic EPUB3/DTBook Migrator is already installed"
else
echo "Installed version: $INSTALLED"
echo "Current version: $CURRENT"
echo "Retrieving current version..."
wget $SNAPSHOTS/builds/$CURRENT -O ~/daisy-pipeline/modules/$CURRENT
if [ "$?" = "0" ]; then
echo "Current version successfully retrieved"
if [ -f "$HOME/daisy-pipeline/modules/$INSTALLED" ]; then
echo "Deleting old version..."
rm ~/daisy-pipeline/modules/$INSTALLED
fi
else
echo "Could not successfully retrieve current version"
if [ -f "$HOME/daisy-pipeline/modules/$CURRENT" ]; then
echo "Deleting remnants of failed download..."
rm ~/daisy-pipeline/modules/$CURRENT
fi
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment