[wpkg-users] Access base dir in package definition

Rainer Meier r.meier at wpkg.org
Tue May 13 11:39:09 CEST 2014


Hi Oliver,

On 13.05.2014 10:23, Oliver Sauder wrote:
> This way I can copy wpkg repo to whatever location I want and simply
> call in on the command line where it is located. No changes needed in
> the wpkg repository itself.
>
> Does that make sense?

I guess you're doing similar setup as I do by synchronizing the software tree 
and wpkg to USB drives. Though I do not really recommend to have the software 
tree located in a sub-folder of wpkg installation. I have initially started 
building my software repository exaclty as in examples found on the wiki. There 
it recomments to use any variable likke %SOFTWARE% to refer to your software.


So all commands use this variable like
<command type="install" cmd='"%SOFTWARE%\mysoftware\installer.exe" /s' />

As you need to launch WPKG with some arguments anyway it's usually launched from 
a CMD lanucher (or WPKG client) or any sort of bootstrapper. In order to define 
global variables just define them before cscript.exe is involved:

@echo off
:: Define SOFTWARE variable.
set SOFTWARE=%~dp0
cscript.exe "%~dp0wpkg.js" /synchronize ...

This nice little bootstrapper would launch WPKG and exposes the SOFTWARE 
variable to point to the folder it is launched within.

Alternatively you can define variables within WPKG itself:
- globally in config.xml
- per-host in hosts.xml
- per-profile in profiles.xml
- per-package in package XML


Actually I do not recommend to try specifying paths in packages relative to WPKG 
installation path. Imagine the use-case where you want to fetch software 
packages from different server or drive than WPKG location. Relying on a 
hard-coded path to WPKG would require you then to update all the packages. 
Therefore it's better to use an independent variable which points to the 
location of WPKG installation.
If you need it to be auto-evaluated, then simply evaluate the location in the 
bootstrapper script as outlined above.


br,
Rainer



More information about the wpkg-users mailing list