[wix-users] Custom Action - Call a Lua File

Russell Haley russ.haley at gmail.com
Wed Jan 31 23:19:42 PST 2018


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://github.com/WinLua/WinLua-VisualStudio/blob/master/Visual%20Studio/WinLua-Installer/Product.wxs

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://pastebin.com/LG7zFuKm

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://github.com/WinLua/WinLua-VisualStudio/tree/master/Visual%20Studio/WinLua-Installer

Cheers,

Russell


More information about the wix-users mailing list