KB20: Using Ketarin to keep setup packages up-to-date
Ketarin is a small application which automatically updates setup packages. As opposed to other tools, Ketarin is not meant to keep your system up-to-date, but rather to maintain a compilation of all important setup packages which can then be burned to disc or put on a USB stick.
Also visit our support forum with helpful resources on the topic: http://ketarin.canneverbe.com/forum
Example 1: Monitor CDBurnerXP updates
If a sofware package, like CDBurnerXP, is always downloadable from a fixed URL which automatically points to the latest version, it's rather simple.
Add a new application, enter a name and enter the URL. CDBurnerXP can always be downloaded from http://cdburnerxp.se/downloadsetup.exe, so this is what we are going to use in this example. Since the downloaded file name actually varies (it includes the version number), save it to a folder so that this file name is used instead of a fixed one. You probably also want to delete previously downloaded files, otherwise you'd keep an archive of *all* versions of CDBurnerXP.
Example 2: Monitor a package from filehippo.com
FileHippo is a frequently updated website which lists all kinds of software packages. It also provides a download opportunity. Ketarin can make use of this information.
Let's use SmartFTP in this example. As in example 1, add a new application and enter a name. Instead of an URL, however, copy and paste the URL of SmartFTP on filehippo.com (http://www.filehippo.com/download_smartftp/) into the FileHippo ID text field. It will automatically extract the corresponding ID from it. Since the name of the downloaded file can also vary in this case, choose a directory as location.
Example 3: Monitor Firefox
Using FileHippo is quite convenient, however, they only list English language software packages. So if you want to, let's say, monitor the German version of Firefox you can't use it. Also, there is no fixed direct download URL available for Firefox.
So what do we do? First of all, let's download the wanted version of Firefox from http://www.mozilla.com/en-US/firefox/all.html. Once the download has started, determine the location you are downloading from. Depending on the browser you are using, you can possibly rightclick on the active download and choose “Show source URL” or “Copy source URL to clipboard”. The actual URL could be this one for example:
http://mozilla.jiddernet.se/firefox/releases/3.0.1/ win32/de/Firefox%20Setup%203.0.1.exe
From this URL, we can probably figure, that we'd only have to replace the version number 3.0.1 with the new version number as soon as an update for Firefox is available. So let's use this one as URL:
http://mozilla.jiddernet.se/firefox/releases/{version}/ win32/de/Firefox%20Setup%20{version}.exe
Now we only have to define where to get {version} from. To do this, click on the Variables button next to the URL.
Press Enter or click the +-Button. Enter “version” (without quotes) as name. For “Contents of URL” enter http://www.mozilla.com/en-US/firefox/all.html. Press Load. In the field below, enter “german” and press Find. Scroll a bit down if necessary, until you see
<td class="curVersion" >3.0.1</td>
This seems like a nice portion of the site to extract the latest version number from. Select the text before 3.0.1 and press “Use selection as start”, then select the text after 3.0.1 and press “Use selection as end”. Now 3.0.1 should be drawn in a bold font, with a red text before and a blue text behind.
Press OK. Now Ketarin will always replace {version} in the URL with the version number written on the website, which should lead to a valid download URL.
Enter the remaining information (save path, options) and press OK.
Commands
In the “Commands” tab of each application you can enter a command which is to be executed before or after every update. This is useful for unzipping ZIP packages, virus scans, installations in background and other purposes. You can also specify a default command for all applications in the settings.
By default, Ketarin waits for the commands to be finished before proceeding with the next download. If you do not like that, you can put an “&” at the very end of the command to execute it in background. If you want to specify multiple commands, you can connect them with “&&” like “copy {$file} … && del {file}”. You can also temporarily disable a command by adding “rem ” at the beginning.
Special variables
Additional to the user defined variables, you can use these predefined ones:
Name | Content | Example |
---|---|---|
{file} | Location of the downloaded file (only for commands) Remember to enclose this variable in double quotes (“) if the path contains spaces. | c:\…\x.exe |
{filesize} | Size of the downloaded file in bytes | 1482245 |
{root} | Root of the application startup path | c:\ |
{startuppath} | Startup path of the current Ketarin instance (without exe file) | c:\…\ |
{category} | Category of the application | Security |
{appname} | Name of the application | Ketarin |
{appguid} | GUID of the application | {AC1DB…} |
{url:ext} | Extension of the file that is being downloaded | exe |
{url:basefile} | Base file name of the file that is being downloaded | Ketarin-0.9 |
{property:X} | Property of an application. X is the name of a property (like “Name”). For all property names check the XML that is generated when exporting an application. The element names correspond to the property names. | |
{time} or {time-x} or {time+x} | UNIX timestamp of the current time, where x represents the time zone offset in hours. | 1285772250 |
The following variables can be used either as they are (for example {dd}) or like {f:dd}. The latter one refers to the date of the downloaded file, instead of the system date.
{dd} | Day | 10 |
{ddd} | Day name | Tue |
{dddd} | Full day name | Tuesday |
{hh} | 2 digit hour | 10 |
{HH} | 2 digit hour (24h) | 22 |
{mm} | Minute 00-59 | 10 |
{MM} | Month 01-12 | 10 |
{MMM} | Month abbreviation | Oct |
{MMMM} | Month full name | December |
{ss} | Seconds 00-59 | 10 |
{tt} | AM or PM | PM |
{yy} | Year, 2 digits | 06 |
{yyyy} | Year | 2006 |
{zz} | Timezone offset, 2 digits | -05 |
{zzz} | Timezone offset, 2 digits | -05:00 |
More on variables: Functions
Sometimes you might need a variable value just slightly modified. For such cases, you can use a couple of functions on variables (feel free to suggest more). They are used like this: {variablename:function:argument1:argument2}
Name | Description |
---|---|
directory | Extracts the directory name of an URL/file path |
empty | Have the variable return an empty string always |
ext | Extracts the file extension (without dot) of an URL/file path |
filename | Returns the file name (with extension) from a file path |
formatfilesize | Nicely formats a file size (given in bytes) |
multireplace | Replaces multiple subjects within a string. Usage |
multireplacei | Replaces multiple subjects within a string (case insensitive). Usage |
regex | Returns the value which is matched by the regular expression (first argument). If groups exist, you can also select a group's value with the second argument. 0 is the whole match, 1 the first group, 2 the second group and so on. |
regexreplace | Replaces the content matched with the regular expression (first argument) with the second argument. The second argument may contain $n as references to groups of the regular expression. |
replace | Replaces all occurrences of argument1 with argument2 |
trim | Removes all whitespace at the start and end of a variable. If an argument is given, all characters of that string will be removed. |
trimstart | Like trim, but only for the beginning of a word |
trimend | Like trim, but only for the end of a word |
toupper | Outputs only uppercase characters |
tolower | Outputs only lowercase characters |
split | Splits the variable content at each occurrence of the first argument and returns the part of the string with the number specified in the second argument (zero based) |
startuppath | Returns the startup path of the current Ketarin instance (without exe file) |
The custom column
If you right-click on the list view header, you can enable an addional column, called “Custom value” (you can also hide existing ones btw). If enabled, this column will contain the value of a specifc variable, for example the version number. You can define in the settings dialog which variable to use here. Note that this will only work if the variable is actually defined for an application.
Command line options
You can also run Ketarin from command line. These arguments are available:
/database=FILENAME | Starts Ketarin with the specified database |
/export=FILENAME | Exports the whole Ketarin database as XML to the specified location |
/log=FILENAME | On exit, Ketarin saves the log as file to the specified location |
/notify | (additional to /SILENT) Ketarin will show an icon in the task bar |
/silent | No GUI is shown and Ketarin updates all available applications |
Templates
An application template is basically an application minus some information. For example, there is no GUID attached to it, so you can import a template multiple times. Typically, a template allows you to download an application of your choice from a website which offers a plethora of downloads.
If you want to share application templates, you can export an existing application as template by choosing “Application Template” as output file type for File –> Export. After that, you can add placeholders manually to the exported XML. When a user imports an application template with placeholders, he will be asked to insert values for them.
To add a placeholder, just add
<placeholder name="This will be shown to the user" />
to the exported XML. You can add as many as you like. The user will only be prompted once for multiple placeholders with the same name.
Portability
If you consider .NET applications (which require the .NET framework) portable, you can consider Ketarin to be portable as well. It doesn't need an installation, so you can run it from any location you like.
By default, Ketarin will create a database file in %appdata%/Ketarin, so that it is a per-user database. You can also move this file to the application path (where Ketarin.exe is located), then it will always use the database from the startup location and is thus suited for USB sticks or the like.