[wpkg-users] Set variable based on Computer Name

K.E.Jones at brighton.ac.uk K.E.Jones at brighton.ac.uk
Fri Jan 6 22:52:22 CET 2012


Hi,

 Sorry for the top post but Outlook sucks at quoting responses and this is only half
on-topic :-)

 I did some tweaks to our V1.2 wpkg.js to add variable support in config.xml. I'll try
and catch up with V1.3 and submit them as candidate patches if you've not already covered
that base. (Gosh, I really need to find time to have a look at v1.3!)

 Having env. variable support in config.xml makes it incredibly easy to handle scenarios
like this. You just set up multiple config.xml's with the appropriate variables set up and
then make use of WPKG's /config argument to switch between different config.xml files.

 With a little bit of planning and some careful thinking you can handle things like this, 
remote sites that need local repositories and many load balancing needs. In theory, you
could even use it as an alternative way to handle 32-bit vs 64-bit.

 Your mileage may vary but the thought looks good to me :-)

 Fingers crossed, candidate patches on the way this weekend.

 Have fun,

 Keefy
 

> -----Original Message-----
> From: wpkg-users-bounces at lists.wpkg.org [mailto:wpkg-users-
> bounces at lists.wpkg.org] On Behalf Of Rainer Meier
> Sent: 05 January 2012 23:25
> To: Michael MacKay
> Cc: wpkg-users at lists.wpkg.org
> Subject: Re: [wpkg-users] Set variable based on Computer Name
> 
> Hi Michael,
> 
> On 06.01.2012 00:03, Michael MacKay wrote:
> > I have 10 locations I am using WPKG with and use some syncing
> software
> > to deploy the WPKG directory to all the locations.  Currently, I have
> > the WPKG Clients on each workstation have the %SOFTWARE% location
> > variable and wpkg.js directed to the local server, so all the files
> in
> > the WPKG directory are common across all locations.
> >
> > I would like to set it to allow a local initialization of wpkg.js but
> > when I run it from a batch file it doesn't have the %SOFTWARE%
> > variable so can't find the installers.
> >
> > I use a common hostname structure; Each office has a unique first
> four
> > characters on all system, with the server having only the four
> > characters. SO when I run this on any client it will pull the script.
> >
> >     set SERVER=%computername:~0,4%
> >
> >     cscript //%SERVER%/WPKG/wpkg.js /synchronize
> >
> >
> >
> > Unfortunately, it doesn't have the WPKG variable for the software
> path
> > as that is in the WPKG Client.  Is there a way to set a WPKG variable
> > based on the first four characters of the hostname?  Then I could
> > build that into the package.xml and can run the wpkg.js without the
> > client which would allow me to troubleshoot easier, as well as
> manually start wpkg to  install on systems without rebooting.
> > I am sure it wouldn't be hard, I just don't know javascript at all...
> 
> I am not sure if I fully understood your use case as I just skimmed
> your text.
> 
> If you call wpkg.js from script you might just set the SOFTWARE
> variable in the
> script:
> 
> 
> @echo off
> set SERVER=%computername:~0,4%
> set SOFTWARE=\\%SERVER%\share\software
> cscript \\%SERVER%\WPKG\wpkg.js /synchronize
> 
> If you call wpkg.js by WPKG-Client, then just set SERVER and SOFTWARE
> variables
> in WPKG client variable. Alternatively just configure WPKG client to
> run exactly
> the script above from some share or the local drive. So just use WPKG-
> client to
> do exactly the same thing as you would do manually.
> 
> 
> If you need some variables set in packages then you might use WPKG
> 1.3.0 and
> conditional values:
> 
> <variable name="SERVER" value="abcd">
>    <condition>
>      <check type="host" condition="hostname" value="^abcd" />
>    </condition>
> </variable>
> <variable name="SERVER" value="1234">
>    <condition>
>      <check type="host" condition="hostname" value="^1234" />
>    </condition>
> </variable>
> 
> 
> This will assign the value "abcd" on all hosts where the hostname
> starts with
> "abcd".
> It will assign the value "1234" if the hostname starts with 1234.
> ...
> 
> 
> Like this you can set variables within a package, a profile or within
> host
> assignment.
> 
> br,
> Rainer
> -----------------------------------------------------------------------
> --
> wpkg-users mailing list archives >>
> http://lists.wpkg.org/pipermail/wpkg-users/
> _______________________________________________
> wpkg-users mailing list
> wpkg-users at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/wpkg-users
> 
> ___________________________________________________________
> This email has been scanned by MessageLabs' Email Security
> System on behalf of the University of Brighton.
> For more information see http://www.brighton.ac.uk/is/spam/
> ___________________________________________________________

___________________________________________________________
This email has been scanned by MessageLabs' Email Security
System on behalf of the University of Brighton.
For more information see http://www.brighton.ac.uk/is/spam/
___________________________________________________________



More information about the wpkg-users mailing list