Dropbox Updater

This script updates Dropbox for the user running it. It shows progress using Zenity.

dropupdate.sh
#!/bin/sh
LOCAL=`cat ~/.dropbox-dist/VERSION`
{
    echo "#Local: ${LOCAL} - Fetching latest version..."
    wget --quiet -O /tmp/dropbox_version -nc http://dl.getdropbox.com/u/148/latest-build/experimental.txt
} | zenity --progress --pulsate --auto-close --text "Fetching versions..." --title "Dropbox Updater"
 
LATEST=`cat /tmp/dropbox_version`
VERSION=$LATEST
 
if [ "$LOCAL" \< "$LATEST" ]; then
    ARCH=`uname -m`
    case "$ARCH" in
        i386|i486|i586|i686)
            ARCH="x86"
            ;;
    esac
    DOWNLOADURL="http://dl-web.getdropbox.com/u/17/dropbox-lnx.${ARCH}-${VERSION}.tar.gz"
    cd ~
    wget $DOWNLOADURL 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title="Dropbox Updater" --auto-close
#    wget -nc --progress=dot $DOWNLOADURL
 
    FILE=`basename $DOWNLOADURL`
    if [ ! -f $FILE ]; then
        zenity --error --text="Downloaded file not found! Aborting..." --title="Dropbox Updater"
        exit 1
    fi
 
    {
        echo 0
        echo "#Stopping Dropbox..."
        dropbox stop
        killall dropbox
        echo 25
        echo "#Removing old installation..."
        rm -rf .dropbox-dist
        echo 50
        echo "#Unpacking new version..."
        tar xvzf $FILE
        echo 75
        cd -
        echo "#Starting Dropbox..."
        dropbox start
        echo 100
    } | zenity --progress --auto-close --text "Updating local Dropbox installation..." --title="Dropbox Updater"
 
    zenity --info --text="Dropbox has been updated to version ${LATEST}." --title="Dropbox Updater"
else
    zenity --info --text="Local version: ${LOCAL}\nLatest version: ${LATEST}\n\nNo update neccessary." --title="Dropbox Updater"
fi

 
software/sh/dropbox-updater.txt · Last modified: 2010-01-15 13:39.00 by mbirth
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Contents powered by Club-Mate Contents powered by BassDrive.com Labelled with ICRA