Runtime checks
- Check for presence of WX when running a GUI app - Ensure current Erlang runtime matches bytecode on Linux
This commit is contained in:
parent
839f59c321
commit
30f1c04325
@ -6,8 +6,15 @@
|
||||
version=0.12.3
|
||||
zx="zx-$version"
|
||||
tarball="$zx.tar.gz"
|
||||
target="https://zxq9.com/projects/zomp/$tarball"
|
||||
|
||||
if command -v wget &> /dev/null
|
||||
then
|
||||
wget -nv "$target"
|
||||
else
|
||||
curl -s "$target" --output "$tarball"
|
||||
fi
|
||||
|
||||
wget -nv "https://zxq9.com/projects/zomp/$tarball"
|
||||
tar -zxf "$tarball"
|
||||
cd "$zx"
|
||||
chmod +x install
|
||||
|
||||
23
unix/zx
23
unix/zx
@ -1,7 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ -f "$HOME/.bash_profile" ]
|
||||
then
|
||||
then
|
||||
. "$HOME"/.bash_profile
|
||||
fi
|
||||
|
||||
@ -9,12 +9,29 @@ 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
|
||||
then
|
||||
chmod +x make_zx
|
||||
./make_zx
|
||||
./make_zx 1>&2
|
||||
fi
|
||||
cd "$start_dir"
|
||||
erl -noshell -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||
|
||||
23
unix/zxh
23
unix/zxh
@ -1,7 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ -f "$HOME/.bash_profile" ]
|
||||
then
|
||||
then
|
||||
. "$HOME"/.bash_profile
|
||||
fi
|
||||
|
||||
@ -9,12 +9,29 @@ 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
|
||||
then
|
||||
chmod +x make_zx
|
||||
./make_zx
|
||||
./make_zx 1>&2
|
||||
fi
|
||||
cd "$start_dir"
|
||||
erl -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||
|
||||
@ -1 +1 @@
|
||||
0.12.5
|
||||
0.12.6
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{application,zx,
|
||||
[{description,"An Erlang development tool and Zomp user client"},
|
||||
{vsn,"0.12.5"},
|
||||
{vsn,"0.12.6"},
|
||||
{applications,[stdlib,kernel]},
|
||||
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
|
||||
zx_lib,zx_local,zx_net,zx_peer,zx_peer_man,
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -24,7 +24,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -1173,11 +1173,11 @@ fetch2(ID) ->
|
||||
%% Gets all the target application's ducks in a row and launches them, then enters
|
||||
%% the exec_wait/1 loop to wait for any queries from the application.
|
||||
|
||||
execute(lib, PackageID, _, _, _) ->
|
||||
Message = "Lib ~ts is available on the system, but is not a standalone app.",
|
||||
{ok, PackageString} = zx_lib:package_string(PackageID),
|
||||
ok = tell(Message, [PackageString]),
|
||||
init:stop();
|
||||
execute(gui, PackageID, Meta, Dir, RunArgs) ->
|
||||
case wx_available() of
|
||||
true -> execute(PackageID, Meta, Dir, RunArgs);
|
||||
false -> {error, "WX (GUI system) is not found. Aborting."}
|
||||
end;
|
||||
execute(cli, PackageID, Meta, Dir, RunArgs) ->
|
||||
Name = element(2, PackageID),
|
||||
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
||||
@ -1190,15 +1190,32 @@ execute(cli, PackageID, Meta, Dir, RunArgs) ->
|
||||
Mod = list_to_atom(ModName),
|
||||
Mod:start(RunArgs)
|
||||
end;
|
||||
execute(Type, PackageID, Meta, Dir, RunArgs) ->
|
||||
execute(app, PackageID, Meta, Dir, RunArgs) ->
|
||||
execute(PackageID, Meta, Dir, RunArgs);
|
||||
execute(lib, PackageID, _, _, _) ->
|
||||
Message = "Lib ~ts is available on the system, but is not a standalone app.",
|
||||
{ok, PackageString} = zx_lib:package_string(PackageID),
|
||||
ok = tell("Starting ~p ~ts.", [Type, PackageString]),
|
||||
ok = tell(Message, [PackageString]),
|
||||
init:stop().
|
||||
|
||||
execute(PackageID, Meta, Dir, RunArgs) ->
|
||||
{ok, PackageString} = zx_lib:package_string(PackageID),
|
||||
ok = tell("Starting ~ts.", [PackageString]),
|
||||
Name = element(2, PackageID),
|
||||
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
||||
AppTag = list_to_atom(Name),
|
||||
ok = ensure_all_started(AppTag, permanent),
|
||||
log(info, "Launcher complete.").
|
||||
|
||||
wx_available() ->
|
||||
try
|
||||
_ = wx:null(),
|
||||
true
|
||||
catch
|
||||
error:undef ->
|
||||
false
|
||||
end.
|
||||
|
||||
|
||||
-spec ensure_all_started(AppMod, Type) -> ok
|
||||
when AppMod :: module(),
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_auth).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_conn_sup).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -138,7 +138,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_daemon).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_key).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_lib).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_local).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_net).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_man).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peer_sup).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -10,7 +10,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_peers).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_proxy).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_sup).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-behavior(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_tty).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -5,7 +5,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_userconf).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -7,7 +7,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(zx_zsp).
|
||||
-vsn("0.12.5").
|
||||
-vsn("0.12.6").
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
-license("GPL-3.0").
|
||||
@ -9,7 +9,7 @@
|
||||
{license,"MIT"}.
|
||||
{modules,[]}.
|
||||
{name,"zx"}.
|
||||
{package_id,{"otpr","zx",{0,12,5}}}.
|
||||
{package_id,{"otpr","zx",{0,12,6}}}.
|
||||
{prefix,"zx_"}.
|
||||
{repo_url,"https://gitlab.com/zxq9/zx"}.
|
||||
{tags,["tools","package manager","erlang"]}.
|
||||
Loading…
x
Reference in New Issue
Block a user