[wpkg-users] Env variables within WPKG vars in <check /> statements do not resolve

Chris Allen callen at katmairesearch.com
Wed Jun 10 01:38:55 CEST 2009


Stefan, thanks for the fix.  I applied the fix and tested it, it worked and
so far I haven't had any problems.

One of the changes I noticed in 1.1 the prepending @COMSPEC /C on commands.
Since I recently started using WPKG and posting to this group I missed the
discussion on this, but I have to wonder why

cmd = '%COMSPEC% /s /c "' + cmd + '"';

wasn't used instead.  Does this have some unintentional side effects?
Obviously it would break some install scripts out there, but so did the
addition of @comspec /c.  Not that I'm complaining, I think this is a good
move, I just hate having to keep track of those special circumstances when I
need to wrap the whole command in double quotes.


I wrote a tiny little AutoIT3 wrapper around wpkg.js to throw up some GUI
buttons for commonly used functions and I have found very handy when
testing.  And my Jr. admins like it when they want to quickly check what's
installed on someone's machine.  Anyway I figured that maybe I should post
it on here just in case someone else finds it useful.  Save it as a .au3
file and place it into the same directory as wpkg.js


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; wpkg_tool
; program to help in launching wpkg interactively
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$wpkg_client_settings = @ScriptDir & "\settings.xml"
$wpkg_client_installer = "\\mydomain\soft\sys\WPKG Client v1.3.6\WPKG Client
1.3.6.msi"

$args = "/synchronize "

; create GUI menu
GUICreate("WPKG Tool", 120, 460, -1, -1, -1, $WS_EX_TOOLWINDOW)
$custom = GUICtrlCreateButton("&Custom",           10, 10,  100)
GUICtrlSetState( -1, $GUI_DEFBUTTON )

$debug = GUICtrlCreateButton("&Debug Sync",        10, 60,  100)
$debugf = GUICtrlCreateButton("&Debug Force Sync", 10, 90,  100)
$dryrun = GUICtrlCreateButton("Dry &Run Sync",     10, 120,  100)
$quiet = GUICtrlCreateButton("&Quiet Sync",        10, 150, 100)

$lall = GUICtrlCreateButton("&List All",             10, 200, 100)
$linst = GUICtrlCreateButton("List Installed",       10, 230, 100)
$luninst = GUICtrlCreateButton("List Not Installed", 10, 260, 100)
$lup = GUICtrlCreateButton("List Upgradable",        10, 290, 100)

$inst = GUICtrlCreateButton("&Install Client",       10, 340, 100)

$help = GUICtrlCreateButton("&Help",                 10, 390, 100)
$cancel = GUICtrlCreateButton("Ca&ncel",             10, 420, 100)

GUISetState( @SW_SHOW )
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg == $debug
            $args &= "/debug"
            ExitLoop
        Case $msg == $debugf
            $args &= "/debug /force"
            ExitLoop
        Case $msg == $dryrun
            $args &= "/dryrun"
            ExitLoop
        Case $msg == $quiet
            Run( "wscript " & @ScriptDir & "\wpkg.js /synchronize /quiet" )
            Exit
        Case $msg == $lall
            $args = "/query:a | more"
            ExitLoop
        Case $msg == $linst
            $args = "/query:i | more"
            ExitLoop
        Case $msg == $luninst
            $args = "/query:x | more"
            ExitLoop
        Case $msg == $lup
            $args = "/query:u | more"
            ExitLoop
        Case $msg == $custom
            $custargs = InputBox( "WPKG args", "Enter arguments for WPKG
below:" )
            If @error == 0 Then
                If StringStripWS( $custargs, 8) == "" Then Exit
                $args = $custargs & " /debug"
                ExitLoop
            EndIf
        Case $msg == $help
            $args = "/? | more"
            ExitLoop
        Case $msg == $inst
            Run( 'msiexec /norestart /qb /i "' & $wpkg_client_installer & '"
ALLUSERS=1 SETTINGSFILE="' & $wpkg_client_settings & '"' )
            Exit
        Case $msg == $cancel
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

$cmd = "cscript " & @ScriptDir & "\wpkg.js " & $args
Run( @ComSpec & ' /c ' & $cmd & ' & pause' )


On Tue, Jun 9, 2009 at 1:24 PM, Rainer Meier <r.meier at wpkg.org> wrote:

> Hi both,
>
> Pendl Stefan wrote:
> > Chris Allen wrote:
> > <variable name='cygroot' value='%SYSTEMDRIVE%\cygwin' />
> > <check type="file" condition="exists" path="%cygroot%\Cygwin.bat" />
> > The problem appears only when using nested variables.  These examples
> work fine:
> >
> > <variable name='cygroot' value='C:\cygwin\cygwin' />
> > <check type="file" condition="exists" path="%cygroot%\Cygwin.bat" />
> >
> > Or:
> >
> > <check type="file" condition="exists"
> path="%SYSTEMDRIVE%\cygwin\Cygwin.bat" />
> ...
>
> > // --- insert this
> >
> > var shell = new ActiveXObject("WScript.Shell");
> >   variableValue = shell.ExpandEnvironmentStrings(variableValue);
> >
> > // --- end insert
> >
> ...
>
> The proposal actually looks good. I hope it's not having some strange
> side-effects. But immediately expanding variables could make sense here. So
> I've
> added this change to WPKG 1.1.1-RC2. You might get it from here:
>
> <
> http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/1.1/wpkg.js?view=log
> >
>
> Or download Revision 77 directly from here:
>
> <
> http://wpkg.svn.sourceforge.net/viewvc/wpkg/wpkg/stable/1.1/wpkg.js?revision=77
> >
>
>
> It contains a bunch of other fixes/enhancements too:
>
> NEW: Added a new switch: /noUpgraeBeforeRemove.
>     This switch allows to disable the upgrade-before-remove feature.
>     Usually WPKG upgrades a package to the latest available version before
> it
>         removes the package. This allows administrators to fix bugs in the
> package
>         and assure proper removal.
>         However this feature can lead to (sometimes unexpected)
> re-execution of
>         packages. For example if execution=always is used the package will
> run
>         once again before it is finally removed.
>         It's advised to leave this option on default unless you really know
> what
>         you're doing.
>         Thanks to Simon.
> MOD: Fixed typo in in database-inconsistency message. Thanks to Gerd Ott.
> MOD: Changed Wording after successful installation of a package.
>     Thanks to Simon.
> MOD: Enhanced variable expansion within <variable /> nodes. If the value
>     contains shell variables they are expanded immediately.
>     Thanks to Chris Allen for reporting and Stefan Pendl for fix
> suggestion.
>
>
> @Simon: If you read this you probably noticed that it also contains a
> change for
> you which allows to disable the upgrade-before-remove feature. You might
> test it
> and give feedback if it serves your needs.
>
>
> If it works fine I will release it soon.
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20090609/7899fcab/attachment-0002.html>


More information about the wpkg-users mailing list