diff options
author | Simon Tatham <anakin@pobox.com> | 2017-05-17 19:29:08 +0100 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2017-05-17 19:29:08 +0100 |
commit | e8d91ad3692c3e8941f86d5d2fe51eb572f20095 (patch) | |
tree | b5e52f6e53971bcea7fb32568e225a0d0c8114b3 | |
parent | ad56c28a707e037ec879f7feba4e711ae293dfa2 (diff) | |
download | wix-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-x | wrapper.py | 22 |
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 | |||
3 | import sys | ||
4 | import os | ||
5 | |||
6 | def 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 | |||
14 | scriptname = os.path.basename(sys.argv[0]) | ||
15 | wixdir = os.path.dirname(os.path.abspath(__file__)) | ||
16 | |||
17 | addtopath(os.path.join(wixdir, "libpreload.so"), "LD_PRELOAD") | ||
18 | |||
19 | os.environ["WIX"] = wixdir | ||
20 | |||
21 | dotnet_exe = os.path.join(wixdir, scriptname + ".exe") | ||
22 | os.execvp("/usr/bin/mono", ["mono", dotnet_exe] + sys.argv[1:]) | ||