Created
November 29, 2014 16:41
-
-
Save vaites/3302f114539bbf6aab0d to your computer and use it in GitHub Desktop.
Upgrade Calibre on Mac OS X to latest version
This file contains hidden or 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 | |
CALIBRE_DOWN="http://status.calibre-ebook.com/dist/osx32" | |
CALIBRE_LAST=`curl --head --silent ${CALIBRE_DOWN} | grep "Location" \ | |
| awk '{print $2}' | perl -pi -e 's/\r\n//g'` | |
CURRENT_USER=`whoami` | |
CALIBRE_NAME=`echo ${CALIBRE_LAST} | awk -F '/' '{print $5}'` | |
CALIBRE_FILE="/Users/${CURRENT_USER}/Downloads/${CALIBRE_NAME}" | |
if [ ! -f $CALIBRE_FILE ]; then | |
wget "${CALIBRE_LAST}" -O "${CALIBRE_FILE}" | |
fi | |
if [ -f $CALIBRE_FILE ]; then | |
cd "/Applications/" | |
rm -rf 'Calibre.app' | |
CALIBRE_VOLUME=`hdiutil attach "${CALIBRE_FILE}" \ | |
| grep "calibre" | awk '{print $3}'` | |
cp -R "${CALIBRE_VOLUME}/calibre.app" "/Applications/Calibre.app" | |
hdiutil detach "${CALIBRE_VOLUME}" > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment