Part 1 - Setup an F2 Update site in tomcat
------------------------------------------

In order for easy understanding only the win32 case is described here.
Assume the application is called "example";

Export the eclipse client product to some temporary location with base folder "example_1.0.0"
Make sure that the application contains a jre, an *.exe and a *.ini file in /example_1.0.0/.
Compress/Zip the folder "example_1.0.0" to example_1.0.0.zip (including the folder "example_1.0.0" in the zip).

Create a new tomcat webapps directory
/webapps/updatesite/
Copy the f2 plugin jar to
/webapps/updatesite/WEB-INF/lib/org.eclipse.update.f2_[version].jar
Copy the "example_1.0.0.zip" to
/webapps/updatesite/win32/example_1.0.0.zip

Rebuild the f2 update desciptor f2.txt with the command
java -jar /webapps/updatesite/WEB-INF/lib/org.eclipse.update.f2_[version].jar -create -site /webapps/updatesite -os win32 -name example -verbose

Now the updatesite is ready for use and the f2.txt contains all zip and delta files length, crc and hash.

Part 2 - Initial installation of the client
-------------------------------------------

Simply take the latest zip, say example_1.0.0.zip
Copy it to the clients install location (C:/Program Files/example/example_1.0.0.zip)
Unpack the zip at its location, so that the root example.exe is extracted to  C:/Program Files/example/example.exe

The client application can be started by running example.exe or by creating a shortcut for it on the desktop.

Part 3 - Manual update of a client installation
-----------------------------------------------

Copy the f2 plugin to some directory, say /temp/org.eclipse.update.f2_[version].jar
Run the command
java -jar /temp/org.eclipse.update.f2_[version].jar -update -url http://hostname:port/updatesite -os win32 -arch x86 -name example -install "C:/Program Files/example" -verbose
-url is the url of the updatesite
-install is the root folder of the client installation

Option: In order to use http basic auth, add the command line parameters
-http.user [user] -http.pass [pass]

Option: In order to log only errors, use -silent instead of -verbose
Basically logging is done using java.util.logging, so all therefore concepts hold.


Part 4 - Automatic update of a client
-------------------------------------
From your plugin containing the eclipse IApplication add a dependency to org.eclipse.update.f2.

Somewhere in your application code where it best fits for you simply call:
UpdateResult result = F2Updater.update();

Add the following entries to the config.ini of your product configuration
f2.url=http://hostname:port/updatesite
f2.name=example

Option: In order to use http basic auth add the config.ini parameters
f2.http.user=[user]
f2.http.pass=[pass]


Usage of F2 console
-------------------
Create an f2 updatesite for an OS.ARCH in a updatesite sub folder
  java -jar org.eclipse.update.f2_(version).jar -create -site (updatesite root dir) -os (OS) -arch (ARCH) -name (app-name)

Update an application folder manually
  java -jar org.eclipse.update.f2_(version).jar -update -url (updatesite root url) -os (OS) -arch (ARCH) -name (app-name) -install (app-install-root-folder)
  the exit code is 0='nothing to do', 200='update done', 404='version not found or f2 configuration problem', 500='error'

Options for logging:
  -verbose for detailed logging
  -silent for sparse logging

Options for HTTP Basic auth:
  -http.user username
  -http.pass password
  the config.ini parameters are 'f2.http.user', 'f2.http.pass'

Option for Windows 7 UAC (user access control)
  -uac true
  default is true if the client zip contains the f2 plug-in, false otherwise
  the config.ini parameter is 'f2.uac'

Option to only update up to a limited version
  -version example_1.2.0
  the config.ini parameter is 'f2.version'

Option to enable/disable content hash check on delta updates
  -checkhash true
  default is true
  the config.ini parameter is 'f2.checkhash'

Option to use specific temp directory
  -temp D:/TEMP
  the config.ini parameter is 'f2.temp'

Option to keep only a specific number of application versions when creating the updatesite
  -versionsToKeep 5
  the config.ini parameter is 'f2.versionsToKeep'


Windows batch script example
----------------------------

REM BEGIN SCRIPT
@echo off
java -jar org.eclipse.update.f2_0.9.0.201202201752.jar -update ...
goto f2_exitcode_%errorlevel%

:f2_exitcode_0
echo no change
goto end

:f2_exitcode_200
echo changed
goto end

:f2_exitcode_404
echo version do not exist
goto end

:f2_exitcode_500
echo error
goto end

:end
REM END SCRIPT

