[wpkg-users] Access base dir in package definition

Oliver Sauder os at esite.ch
Tue May 13 16:32:36 CEST 2014


Yep a wrapper script should do the trick, although this has the
disadvantage that all different calls have to call the wrapper script.
Doable but will give me some work to reconfigure all systems/scripts...

We usually bundle wpkg together with packages. So if there is a
different location there will always be a wpkg.js available. I see your
point that this might not be desirable as it is kind of a duplication of
data but in general not such a big deal so I do not worry to have the
software packages and wpkg in one structure. And in the end is it always
possible to overwrite the SOFTWARE variable if really necessary.

For now we have put the location as variable in the config.xml but a bit
annoying to change such and I guess the wrapper script should be more
convenient.

Thanks,
Oliver

On 13.05.2014 12:39, Rainer Meier wrote:
> 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