Skip to content

Commit 8c43e96

Browse files
committed
Allow environment variable to set the Lua executable
For some distros (e.g. Arch Linux) packaging binaries compiled elsewhere is a big no-no, and the more so when they are duplicates of something the system has anyway. The current Arch Linux packaging for example has to remove the generated binaries from the installation, then patch this wrapper script to use the system Lua executable. This change will make that process easier. First it will be possible to run with a different Lua executable by setting an environment variable: LUA_EXECUTABLE=/usr/bin/lua zbstudio Second, the coding style in the script will make it much easier to patch to make the that choice stick.
1 parent e09d861 commit 8c43e96

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

zbstudio/zbstudio.in

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/usr/bin/env sh
22

3-
if [[ "$(uname -m)" == "x86_64" ]]; then ARCH="x64"; else ARCH="x86"; fi
4-
CWD="$PWD" # save the current directory, as it's going to change
3+
# Stash the current PWD so we can pass it to the IDE, the
4+
# IDE itself will be launched from it's own location
5+
CWD="$PWD"
6+
7+
# Figure out which architecture binary is approprate for the host system
8+
case $(uname -m) in
9+
*64) ARCH="x64" ;;
10+
*) ARCH="x86" ;;
11+
esac
12+
13+
# Lua executable to run, can be overridden with ENV variable
14+
: ${LUA_EXECUTABLE:="bin/linux/$ARCH/lua"}
515

616
cd "@IDE_DATADIR@"
7-
exec bin/linux/$ARCH/lua src/main.lua zbstudio -cwd "$CWD" "$@"
17+
exec "$LUA_EXECUTABLE" src/main.lua zbstudio -cwd "$CWD" "$@"

0 commit comments

Comments
 (0)