wix-on-linux/wrapper.py
Simon Tatham e8d91ad369 Top-level wrapper script to do the environment setup.
This sets up $WIX and $LD_PRELOAD before running a Wix .NET executable
via mono, so the user doesn't have to have pre-prepared those
variables (and, in particular, libpreload doesn't uncontrolledly
affect loads of other stuff too).
2017-05-17 19:29:08 +01:00

22 lines
591 B
Python
Executable file

#!/usr/bin/env python
import sys
import os
def addtopath(val, varname):
newvar = val
if varname in os.environ:
if val in os.environ[varname].split(":"):
return # already there
newvar += ":" + os.environ[varname]
os.environ[varname] = newvar
scriptname = os.path.basename(sys.argv[0])
wixdir = os.path.dirname(os.path.abspath(__file__))
addtopath(os.path.join(wixdir, "libpreload.so"), "LD_PRELOAD")
os.environ["WIX"] = wixdir
dotnet_exe = os.path.join(wixdir, scriptname + ".exe")
os.execvp("/usr/bin/mono", ["mono", dotnet_exe] + sys.argv[1:])