Update an application on several PCs with one click

Hey there, happy holidays!

This last month I worked for Fontevraud, the largest abbey in Europe! I updated their iBar program. Inside the main chapel, they have several touch screens displaying Fontevraud’s informations about Eleanor of Aquitaine, a Quiz, a Pacman retracing the story of a prisoner (the abbey was a prison after the French Revolution)…

The iBar program (PC only) works exactly like an iPad, a main screen launching applications. That was the first time that I worked for a museum, and so there were new kinds of problematics: how to know if a touch screen crashed and notify someone? How to get the errors for fixing them later? How to update the application on each touchscreen without human intervention on each machine?

The application has been developed with Adobe AIR. It enables to load other kind of program (.exe) thanks to the NativeProcess class.

Updating application
As I said, one of the most important request for this update was to be able to update all the eight touch screens without human intervention. Something automatic, but that we could control. We use git as our source system synchronizer so why not using it for this kind of magical update?

At first, we just had to kill the program, click on a pull button and relaunch the program. But doing it on several computers is very boring and most of all we needed to be able to do the update afar! So we found a better solution:

The main program starts using a launcher app, if there was an update launch it, otherwise start the program. We checked if there is an update thanks to a web page hosted on a server. Basically when we want to push new contents and once the git content is pushed, we press a button on this web page. It will update a txt file changing its date time using the coordinated universal time. The main program checks this file (via a Timer) and if this date is newer than its own registered start the update. When it is completed, it launchs the program.

Our main issue was how to perform a git pull (via a bat) without asking the user to enter his password? There is some kind of magic with a _netrc file. It allows to register password for git! Let see how:

Firstly, check that your %HOME% variable exist. In a cmd write:
echo %HOME%
If it outputs “HOME”, it means it isn’t defined. So write:
Then reboot your computer.

Now create a _netrc file (without extension) and save it in your own folder: C:\Users\”username”. Be careful, the username shouldn’t have spaces! Here is how a _netrc looks like:
machine bitbucket.org
login myLogin
password myPassword

Fill up with your informations.

Now create a .cmd file and write:
..\..\AppData\Local\Atlassian\SourceTree\git_local\bin\git.exe pull
Launch it, it will update your git without asking your password and automatically close the window. Now you may perform automatically update 😉

Flox enables to save statistics à la Google Analytics, manage some backend datas and also register errors! You may do it (in your Main file) via:

    UncaughtErrorEvent.UNCAUGHT_ERROR, function(event:UncaughtErrorEvent):void {
        Flox.logError(event.error, "Uncaught Error: " + event.error.message);

It will save the error stack in the backend… killer feature! And thanks to the UncaughtErrorEvent event you may also send a mail via Amfphp or anything else!

Leave a Reply

Your email address will not be published. Required fields are marked *