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).
This commit is contained in:
Simon Tatham 2017-05-17 19:29:08 +01:00
parent ad56c28a70
commit e8d91ad369

22
wrapper.py Executable file
View file

@ -0,0 +1,22 @@
#!/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:])