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
|
version=0.12.3
|
||||||
zx="zx-$version"
|
zx="zx-$version"
|
||||||
tarball="$zx.tar.gz"
|
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"
|
tar -zxf "$tarball"
|
||||||
cd "$zx"
|
cd "$zx"
|
||||||
chmod +x install
|
chmod +x install
|
||||||
|
|||||||
19
unix/zx
19
unix/zx
@ -9,12 +9,29 @@ export ZOMP_DIR="${ZOMP_DIR:-$HOME/zomp}"
|
|||||||
export ZX_VERSION=$(cat "$ZOMP_DIR/etc/version.txt")
|
export ZX_VERSION=$(cat "$ZOMP_DIR/etc/version.txt")
|
||||||
export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
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"
|
start_dir="$PWD"
|
||||||
cd "$ZX_DIR"
|
cd "$ZX_DIR"
|
||||||
if [ ! -f ebin/zx.beam ]
|
if [ ! -f ebin/zx.beam ]
|
||||||
then
|
then
|
||||||
chmod +x make_zx
|
chmod +x make_zx
|
||||||
./make_zx
|
./make_zx 1>&2
|
||||||
fi
|
fi
|
||||||
cd "$start_dir"
|
cd "$start_dir"
|
||||||
erl -noshell -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
erl -noshell -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||||
|
|||||||
19
unix/zxh
19
unix/zxh
@ -9,12 +9,29 @@ export ZOMP_DIR="${ZOMP_DIR:-$HOME/zomp}"
|
|||||||
export ZX_VERSION=$(cat "$ZOMP_DIR/etc/version.txt")
|
export ZX_VERSION=$(cat "$ZOMP_DIR/etc/version.txt")
|
||||||
export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
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"
|
start_dir="$PWD"
|
||||||
cd "$ZX_DIR"
|
cd "$ZX_DIR"
|
||||||
if [ ! -f ebin/zx.beam ]
|
if [ ! -f ebin/zx.beam ]
|
||||||
then
|
then
|
||||||
chmod +x make_zx
|
chmod +x make_zx
|
||||||
./make_zx
|
./make_zx 1>&2
|
||||||
fi
|
fi
|
||||||
cd "$start_dir"
|
cd "$start_dir"
|
||||||
erl -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
erl -pa "$ZX_DIR/ebin" -run zx do -extra $@
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
0.12.5
|
0.12.6
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{application,zx,
|
{application,zx,
|
||||||
[{description,"An Erlang development tool and Zomp user client"},
|
[{description,"An Erlang development tool and Zomp user client"},
|
||||||
{vsn,"0.12.5"},
|
{vsn,"0.12.6"},
|
||||||
{applications,[stdlib,kernel]},
|
{applications,[stdlib,kernel]},
|
||||||
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
|
{modules,[zx,zx_auth,zx_conn,zx_conn_sup,zx_daemon,zx_key,
|
||||||
zx_lib,zx_local,zx_net,zx_peer,zx_peer_man,
|
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
|
%%% @end
|
||||||
|
|
||||||
-module(zx).
|
-module(zx).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(application).
|
-behavior(application).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("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
|
%% 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.
|
%% the exec_wait/1 loop to wait for any queries from the application.
|
||||||
|
|
||||||
execute(lib, PackageID, _, _, _) ->
|
execute(gui, PackageID, Meta, Dir, RunArgs) ->
|
||||||
Message = "Lib ~ts is available on the system, but is not a standalone app.",
|
case wx_available() of
|
||||||
{ok, PackageString} = zx_lib:package_string(PackageID),
|
true -> execute(PackageID, Meta, Dir, RunArgs);
|
||||||
ok = tell(Message, [PackageString]),
|
false -> {error, "WX (GUI system) is not found. Aborting."}
|
||||||
init:stop();
|
end;
|
||||||
execute(cli, PackageID, Meta, Dir, RunArgs) ->
|
execute(cli, PackageID, Meta, Dir, RunArgs) ->
|
||||||
Name = element(2, PackageID),
|
Name = element(2, PackageID),
|
||||||
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
||||||
@ -1190,15 +1190,32 @@ execute(cli, PackageID, Meta, Dir, RunArgs) ->
|
|||||||
Mod = list_to_atom(ModName),
|
Mod = list_to_atom(ModName),
|
||||||
Mod:start(RunArgs)
|
Mod:start(RunArgs)
|
||||||
end;
|
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, 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),
|
Name = element(2, PackageID),
|
||||||
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
ok = zx_daemon:pass_meta(Meta, Dir, RunArgs),
|
||||||
AppTag = list_to_atom(Name),
|
AppTag = list_to_atom(Name),
|
||||||
ok = ensure_all_started(AppTag, permanent),
|
ok = ensure_all_started(AppTag, permanent),
|
||||||
log(info, "Launcher complete.").
|
log(info, "Launcher complete.").
|
||||||
|
|
||||||
|
wx_available() ->
|
||||||
|
try
|
||||||
|
_ = wx:null(),
|
||||||
|
true
|
||||||
|
catch
|
||||||
|
error:undef ->
|
||||||
|
false
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
-spec ensure_all_started(AppMod, Type) -> ok
|
-spec ensure_all_started(AppMod, Type) -> ok
|
||||||
when AppMod :: module(),
|
when AppMod :: module(),
|
||||||
@ -9,7 +9,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_auth).
|
-module(zx_auth).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -7,7 +7,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_conn).
|
-module(zx_conn).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -5,7 +5,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_conn_sup).
|
-module(zx_conn_sup).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(supervisor).
|
-behavior(supervisor).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -138,7 +138,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_daemon).
|
-module(zx_daemon).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(gen_server).
|
-behavior(gen_server).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -8,7 +8,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_key).
|
-module(zx_key).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -10,7 +10,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_lib).
|
-module(zx_lib).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -6,7 +6,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_local).
|
-module(zx_local).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -5,7 +5,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_net).
|
-module(zx_net).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -8,7 +8,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_peer).
|
-module(zx_peer).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -9,7 +9,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_peer_man).
|
-module(zx_peer_man).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(gen_server).
|
-behavior(gen_server).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -6,7 +6,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_peer_sup).
|
-module(zx_peer_sup).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -10,7 +10,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_peers).
|
-module(zx_peers).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(supervisor).
|
-behavior(supervisor).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -5,7 +5,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_proxy).
|
-module(zx_proxy).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -5,7 +5,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_sup).
|
-module(zx_sup).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-behavior(supervisor).
|
-behavior(supervisor).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
@ -6,7 +6,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_tty).
|
-module(zx_tty).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -5,7 +5,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_userconf).
|
-module(zx_userconf).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -7,7 +7,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(zx_zsp).
|
-module(zx_zsp).
|
||||||
-vsn("0.12.5").
|
-vsn("0.12.6").
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
@ -9,7 +9,7 @@
|
|||||||
{license,"MIT"}.
|
{license,"MIT"}.
|
||||||
{modules,[]}.
|
{modules,[]}.
|
||||||
{name,"zx"}.
|
{name,"zx"}.
|
||||||
{package_id,{"otpr","zx",{0,12,5}}}.
|
{package_id,{"otpr","zx",{0,12,6}}}.
|
||||||
{prefix,"zx_"}.
|
{prefix,"zx_"}.
|
||||||
{repo_url,"https://gitlab.com/zxq9/zx"}.
|
{repo_url,"https://gitlab.com/zxq9/zx"}.
|
||||||
{tags,["tools","package manager","erlang"]}.
|
{tags,["tools","package manager","erlang"]}.
|
||||||
Loading…
x
Reference in New Issue
Block a user