zx/unix/zxh
Craig Everett 30f1c04325 Runtime checks
- Check for presence of WX when running a GUI app
- Ensure current Erlang runtime matches bytecode on Linux
2022-01-31 20:18:44 +09:00

38 lines
752 B
Bash
Executable File

#! /bin/bash
if [ -f "$HOME/.bash_profile" ]
then
. "$HOME"/.bash_profile
fi
export ZOMP_DIR="${ZOMP_DIR:-$HOME/zomp}"
export ZX_VERSION=$(cat "$ZOMP_DIR/etc/version.txt")
export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
last_file="$ZOMP_DIR/last.erts"
if [[ -f "$last_file" ]]
then
last_erts=$(cat "$last_file")
else
last_erts="NONE"
fi
curr_erts=$(erl -version 2>&1)
if [[ $last_erts != $curr_erts ]]
then
pushd "$ZOMP_DIR/lib" > /dev/null
find . -name "*.beam" -type f -delete
echo "$curr_erts" > "$last_file"
popd > /dev/null
fi
start_dir="$PWD"
cd "$ZX_DIR"
if [ ! -f ebin/zx.beam ]
then
chmod +x make_zx
./make_zx 1>&2
fi
cd "$start_dir"
erl -pa "$ZX_DIR/ebin" -run zx do -extra $@