aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2017-05-17 19:29:08 +0100
committerSimon Tatham <anakin@pobox.com>2017-05-17 19:29:08 +0100
commite8d91ad3692c3e8941f86d5d2fe51eb572f20095 (patch)
treeb5e52f6e53971bcea7fb32568e225a0d0c8114b3
parentad56c28a707e037ec879f7feba4e711ae293dfa2 (diff)
downloadwix-on-linux-e8d91ad3692c3e8941f86d5d2fe51eb572f20095.tar.gz
wix-on-linux-e8d91ad3692c3e8941f86d5d2fe51eb572f20095.tar.bz2
wix-on-linux-e8d91ad3692c3e8941f86d5d2fe51eb572f20095.zip
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).
-rwxr-xr-xwrapper.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/wrapper.py b/wrapper.py
new file mode 100755
index 0000000..63f8bde
--- /dev/null
+++ b/wrapper.py
@@ -0,0 +1,22 @@
1#!/usr/bin/env python
2
3import sys
4import os
5
6def addtopath(val, varname):
7 newvar = val
8 if varname in os.environ:
9 if val in os.environ[varname].split(":"):
10 return # already there
11 newvar += ":" + os.environ[varname]
12 os.environ[varname] = newvar
13
14scriptname = os.path.basename(sys.argv[0])
15wixdir = os.path.dirname(os.path.abspath(__file__))
16
17addtopath(os.path.join(wixdir, "libpreload.so"), "LD_PRELOAD")
18
19os.environ["WIX"] = wixdir
20
21dotnet_exe = os.path.join(wixdir, scriptname + ".exe")
22os.execvp("/usr/bin/mono", ["mono", dotnet_exe] + sys.argv[1:])