Last active
August 29, 2015 14:07
-
-
Save josteinaj/df3119cd5eeb102a8a03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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