[wix-users] [EXTERNAL] - Re: Custom Action - Call a Lua File

Lewis Henderson henderso at opentext.com
Tue Feb 6 06:04:02 PST 2018


Hi Russell,

To launch a .bat file, you have to lunch a command shell such as cmd.exe and pass your script as an argument to the command shell.

				Lewis

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Russell Haley via wix-users
Sent: Tuesday, February 6, 2018 1:52 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Russell Haley <russ.haley at gmail.com>
Subject: [EXTERNAL] - Re: [wix-users] Custom Action - Call a Lua File

Hi,

So I have added the checkbox item to the exit dialog and I can successfully launch the installed lua.exe via WixShellExec, but I can't run it with a script. I've tried creating a batch file and launching it that way too, with no success.  What I want to do is execute the following command, preferrably in a visible shell:

lua.exe ..\tools\fetch-luarocks.lua -install <path to folder> -bin <path to installed bin> ...

Attempts so far (without the command line options):

<!-- THIS WORKS, BUT I WANT TO LAUNCH MY SCRIPT
  <Property Id="WixShellExecTarget" Value="[#lua.exe]"  />
  <CustomAction Id="LaunchApplication"
              BinaryKey="WixCA"
              DllEntry="WixShellExec"
              Impersonate="yes" />-->

<!--THIS FAILED WITH ?
  <CustomAction Id="LaunchApplication"
              FileKey="run_fetch.bat"
              ExeCommand=""
              Execute="immediate"
              Impersonate="yes"/>-->

    <!--THIS DIDN"T WORK AT ALL. Exit code 1
    <CustomAction Id="RunLua"
                  FileKey="lua.exe"
                  Win64="no"
                  ExeCommand="..\tools\fetch-luarocks.lua" />
    <InstallExecuteSequence>
      <Custom Action="RunLua" After="InstallFinalize" />
    </InstallExecuteSequence>-->

hmmmm....

Russ


On Sun, Feb 4, 2018 at 8:56 PM, Russell Haley <russ.haley at gmail.com> wrote:
> Holy crap, there's like real, *useful* help files in my wix 
> installation. I'm gobsmacked. I can't remember the last time I didn't 
> open a chm file and groan.
>
> Thanks!
> Russ
>
> On Wed, Jan 31, 2018 at 11:19 PM, Russell Haley <russ.haley at gmail.com> wrote:
>> Hello,
>>
>> TLDR;
>>
>> My custom action returns Exit code 1 in the debug logs. I don't know 
>> how to pass the "relative installation path" in the CustomAction to 
>> the script I want called. Here is the product.wxs files with the 
>> custom action at the bottom. Any input would be grand.
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_WinLu
>> a_WinLua-2DVisualStudio_blob_master_Visual-2520Studio_WinLua-2DInstal
>> ler_Product.wxs&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvsw
>> ZOswwnYxaueKkO53V282tTn1P4&m=I2IABXjJH2fxNlh_bwXiVyhTcdsOwCpwo7i_eCm7
>> 6Gs&s=lsDJD-kzRaxsy8QnWx8EXGbjzeIv-lIHcWP2lHAo0g0&e=
>>
>> Full Content:
>>
>> I have an installer for Lua on Windows I'm now calling WinLua. It 
>> works quite well so far. I would like to add the ability at the end 
>> of the installation to optionally download and install LuaRocks (the 
>> lua package manager). I have written a Lua script to download and run 
>> it by calling Powershell commands from within lua. I have tested it 
>> running under program files and set up the installer to add the 
>> scripts. I have also turned Set-ExecutionPolicy to Default.
>>
>> My installer add files here:
>>
>> c:\Program Files\WinLua\Lua\5.3\
>>
>> \bin - lua.exe
>> \tools fetch-luarocks.lua
>>
>> The target directory for LuaRocks also under my installed application 
>> path with a final installed product like such:
>>
>>     Directory: C:\Program Files\WinLua\lua\5.3
>>
>>
>> Mode                LastWriteTime         Length Name
>> ----                -------------         ------ ----
>> d-----       2018-01-31  10:20 PM                bin
>> d-----       2018-01-31  10:20 PM                include
>> d-----       2018-01-29  10:11 PM                LuaRocks
>> d-----       2018-01-31  10:20 PM                staticlib
>> d-----       2018-01-31  10:20 PM                tools
>>
>> I have created a CustomAction hoping to execute the newly installed 
>> Lua and call the lua script file in the tools directory. I don't know 
>> how to us a relative path to the installation so I don't think the 
>> script is being found? My custom action is this:
>>
>>     <CustomAction Id="RunLua"
>>                   FileKey="lua.exe"
>>                   Win64="no"
>>                   ExeCommand="..\tools\fetch-luarocks.lua -u" />
>>     <InstallExecuteSequence>
>>       <Custom Action="RunLua" After="InstallFinalize" />
>>     </InstallExecuteSequence>
>>
>>
>> I turned on debugging in the MSI and the relevant part is this:
>>
>> Action ended 22:20:20: InstallFinalize. Return value 1.
>> MSI (s) (98:0C) [22:20:20:960]: Doing action: RunLua MSI (s) (98:0C) 
>> [22:20:20:960]: Note: 1: 2205 2:  3: ActionText Action 22:20:20: 
>> RunLua.
>> Action start 22:20:20: RunLua.
>> CustomAction RunLua returned actual error code 1 (note this may not 
>> be 100% accurate if translation happened inside sandbox) MSI (s) 
>> (98:0C) [22:20:21:109]: Note: 1: 1722 2: RunLua 3: C:\Program 
>> Files\WinLua\Lua\5.3\bin\lua.exe 4: ..\tools\fetch-luarocks.lua -u 
>> MSI (s) (98:0C) [22:20:21:109]: Note: 1: 2205 2:  3: Error MSI (s) 
>> (98:0C) [22:20:21:109]: Note: 1: 2228 2:  3: Error 4: SELECT 
>> `Message` FROM `Error` WHERE `Error` = 1722 Error 1722. There is a 
>> problem with this Windows Installer package. A program run as part of 
>> the setup did not finish as expected. Contact your support personnel 
>> or package vendor.  Action RunLua, location:
>> C:\Program Files\WinLua\Lua\5.3\bin\lua.exe, command:
>> ..\tools\fetch-luarocks.lua -u
>> MSI (s) (98:0C) [22:20:24:259]: Note: 1: 2205 2:  3: Error MSI (s) 
>> (98:0C) [22:20:24:259]: Note: 1: 2228 2:  3: Error 4: SELECT 
>> `Message` FROM `Error` WHERE `Error` = 1709 MSI (s) (98:0C) 
>> [22:20:24:259]: Product: Lua 5.3 64 Bit -- Error 1722.
>> There is a problem with this Windows Installer package. A program run 
>> as part of the setup did not finish as expected. Contact your support 
>> personnel or package vendor.  Action RunLua, location: C:\Program 
>> Files\WinLua\Lua\5.3\bin\lua.exe, command: 
>> ..\tools\fetch-luarocks.lua -u
>>
>> Action ended 22:20:24: RunLua. Return value 3.
>> Action ended 22:20:24: INSTALL. Return value 3.
>>
>> The full output of the log file is here: 
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__pastebin.com_LG7
>> zFuKm&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxau
>> eKkO53V282tTn1P4&m=I2IABXjJH2fxNlh_bwXiVyhTcdsOwCpwo7i_eCm76Gs&s=2CHy
>> MAUBuCt3jY7fev2JibpDWfG0K_NsvMTWWwibRsU&e=
>>
>> Any input would be great.
>>
>> A secondary problem I have is that the installer will try to run the 
>> script again on uninstall. I am hoping there is a way to 
>> differentiate between installation and removal in a custom action? 
>> Any input would be great as I'm new to custom actions.
>>
>> The full installer sources are here:
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_WinLu
>> a_WinLua-2DVisualStudio_tree_master_Visual-2520Studio_WinLua-2DInstal
>> ler&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueK
>> kO53V282tTn1P4&m=I2IABXjJH2fxNlh_bwXiVyhTcdsOwCpwo7i_eCm76Gs&s=PunOH2
>> aHm_613_YNotX-6e7ijYmuELcv769mhVQPKZ8&e=
>>
>> Cheers,
>>
>> Russell

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant https://urldefense.proofpoint.com/v2/url?u=http-3A__www.firegiant.com_&d=DwICAg&c=ZgVRmm3mf2P1-XDAyDsu4A&r=yAhF6NGJ7EPmZkvswZOswwnYxaueKkO53V282tTn1P4&m=I2IABXjJH2fxNlh_bwXiVyhTcdsOwCpwo7i_eCm76Gs&s=fg2-4hLfbvP3XE8zgDOFTBxThkejs6NYDzTfqMw5bg8&e=



More information about the wix-users mailing list