Git Product home page Git Product logo

is-dropbox-current's Introduction

is-dropbox-current

Checks to see if your locally installed copy of Dropbox is the same as the official release

The Problem

Dropbox is supposed to update itself 'automagically' but sometimes the 'magic' is a bit… um… well, do you remember Ron Weasley in his first year at Hogwarts? It's like sort of like that.

The Solution

Have your computer check periodically to see if you are up-to-date, by comparing the version installed on your Mac vs the version that is offered on Dropbox.com.

If they are identical, hurray.

If not, let the user know.

If Dropbox isn't even installed (oops!) let the user know that too.

"Ok, but how?"

  1. A shell script (naturally) saved somewhere in your $PATH, which you can then either run yourself in Terminal, or run automatically via launchd

  2. A launchd plist which will tell launchd to run the check every so often. (Optional, but recommended.)

Requirements

If you are not going to use launchd, you can just run the shell script from Terminal.app anytime, and you do not need either Growl or terminal-notifier.

If you are going to use launchd, you will need some way for the script to communicate with you:

  • If you are on Mac OS X 10.8 (Mountain Lion) or later, you can use terminal-notifier. The script will check for the terminal-notifier.app to be installed in /Applications/ or the terminal-notifier program to be installed at /usr/local/bin/terminal-notifier. (Hint: if you have Xcode installed and use Homebrew, you can just do brew install terminal-notifier)

  • If you are on earlier versions of Mac OS X, you can use Growl, but only if you also have growlnotify installed. (And, obviously, Growl needs to be running for you to get the notifications.)

"What happens if I have both terminal-notifier and growlnotify installed?"

Growl notifications will show the Dropbox icon, which looks nicer. But terminal-notifier can actually launch the URL to download the latest version of Dropbox if your version is outdated. For that reason, the script will opt to use terminal-notifier if it finds both commands on your Mac.

"How do I install this?"

  1. Download the shell script and put it somewhere in your $PATH such as /usr/local/bin/is-dropbox-current.sh

  2. Make sure it is executable by running this command in Terminal: chmod 755 /usr/local/bin/is-dropbox-current.sh

  3. If you want to use launchd:

    • Download com.tjluoma.is-dropbox-current.plist and save it to ~/Library/LaunchAgents/
    • Run this command in Terminal.app: launchctl load ~/Library/LaunchAgents/com.tjluoma.is-dropbox-current.plist

Note that by default the script will run once a day at 3:00 p.m. local time. You can change that by editing the plist. I highly recommend LaunchControl for working with launchd. Lingon is also very good, and might be a little more "user friendly" if you are not familiar with launchd. Remember to reload the plist after making any changes.

Disclaimer

2013-10-17: This script is "beta" by which I mean "It should work perfectly, but it has not yet been tested under 'real world' conditions, because Dropbox has not released a new version of the Mac app since I wrote it.

It is also worth noting that this script checks http://dropbox.com/install which means two things:

  1. There may be a newer build available in the forums but those are "beta" builds.

  2. The script relies on HTML 'scraping' which is extremely fragile and prone to failure if Dropbox changes the underlying HTML to that page.

2013-10-28:

  • It seems to work fairly well.
  • I added -sender com.getdropbox.dropbox to terminal-notifier.

is-dropbox-current's People

Contributors

tjluoma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

is-dropbox-current's Issues

Some `terminal-notifier` commands might not work

terminal-notifier has a bug/limitation in it where you cannot use -sender with

  • -activate
  • -open
  • -execute

Therefore some of the notifications which say "Click Here To Do X" will not actually work because they are using -sender.

For example:

terminal-notifier -sender com.getdropbox.dropbox \
    -message "Click to download latest version" \
    -title "Dropbox is Not Installed " \
    -subtitle "From: $NAME" \
    -open 'https://www.dropbox.com/downloading?os=mac'

terminal-notifier -sender com.getdropbox.dropbox \
    -message "Click to disable future 'Up-To-Date' alerts" \
    -title "Dropbox is Up-To-Date ($INSTALLED_VERSION)" \
    -subtitle "From: $NAME" \
    -execute "/usr/bin/touch ${HUSHFILE}"

terminal-notifier -sender com.getdropbox.dropbox \
    -message "Click to download version $CURRENT_VERSION" \
    -title "Dropbox $INSTALLED_VERSION is outdated." \
    -subtitle "From: $NAME" \
    -open 'https://www.dropbox.com/downloading?os=mac'

The workaround for this is to remove -sender com.getdropbox.dropbox _however_ note that OS X notifications will not show Dropbox's icon, but will instead show the generic Terminal icon associated with terminal-notifier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.