Add uninstall script; fix typos

This commit is contained in:
Craig Everett 2019-12-16 16:58:33 +09:00
parent ec39a1b1e9
commit 16549b5d0b
57 changed files with 42 additions and 29 deletions

View File

@ -117,7 +117,7 @@ os_cmd(Command) ->
zomp_dir({unix, _}) -> zomp_dir({unix, _}) ->
Home = os:getenv("HOME"), Home = os:getenv("HOME"),
filename:join(Home, ".zomp"); filename:join(Home, "zomp");
zomp_dir({win32, _}) -> zomp_dir({win32, _}) ->
Path = os:getenv("LOCALAPPDATA"), Path = os:getenv("LOCALAPPDATA"),
filename:join(Path, "zomp"); filename:join(Path, "zomp");

12
packup
View File

@ -1,13 +1,16 @@
#! /usr/bin/env escript #! /usr/bin/env escript
main([Version]) -> main(_) ->
{ok, BV} = file:read_file("zomp/etc/version.txt"),
Version = string:strip(binary_to_list(BV), both, $\n),
Tar = "zomp.tar.gz", Tar = "zomp.tar.gz",
ok = erl_tar:create(Tar, ["zomp"], [compressed]), ok = erl_tar:create(Tar, ["zomp"], [compressed]),
Zip = "zx-" ++ Version ++ ".zip", Zip = "zx-" ++ Version ++ ".zip",
ZipFiles = ZipFiles =
["install.escript", ["install.escript",
"install_unix", "install_unix",
"uninstall_unix",
"install_windows.cmd", "install_windows.cmd",
"notify.vbs", "notify.vbs",
"README.md", "README.md",
@ -17,8 +20,5 @@ main([Version]) ->
Tar], Tar],
{ok, Zip} = zip:create(Zip, ZipFiles), {ok, Zip} = zip:create(Zip, ZipFiles),
ok = file:delete(Tar), ok = file:delete(Tar),
ok = io:format("Wrote ~ts.~n", [Zip]), ok = io:format("~ts~n", [Zip]),
halt(0); halt(0).
main(_) ->
ok = io:format("Provide a single version or extension string as an argument.~n"),
halt(1).

5
uninstall_unix Executable file
View File

@ -0,0 +1,5 @@
#! /bin/sh
rm -f "$HOME/bin/zx"
rm -f "$HOME/bin/zxh"
rm -rf "$HOME/zomp"

View File

@ -1 +1 @@
0.2.1 0.3.0

View File

@ -24,7 +24,7 @@
%%% @end %%% @end
-module(zx). -module(zx).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -9,7 +9,7 @@
%%% @end %%% @end
-module(zx_auth). -module(zx_auth).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -7,7 +7,7 @@
%%% @end %%% @end
-module(zx_conn). -module(zx_conn).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -5,7 +5,7 @@
%%% @end %%% @end
-module(zx_conn_sup). -module(zx_conn_sup).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -138,7 +138,7 @@
%%% @end %%% @end
-module(zx_daemon). -module(zx_daemon).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").
@ -2435,6 +2435,7 @@ cx_store_cache(#cx{realms = Realms, hosts = Hosts}) ->
cx_write_cache({Realm, #rmeta{serial = Serial}}) -> cx_write_cache({Realm, #rmeta{serial = Serial}}) ->
CacheFile = cx_realm_cache(Realm), CacheFile = cx_realm_cache(Realm),
CacheMeta = [{serial, Serial}], CacheMeta = [{serial, Serial}],
ok = filelib:ensure_dir(CacheFile),
zx_lib:write_terms(CacheFile, CacheMeta). zx_lib:write_terms(CacheFile, CacheMeta).

View File

@ -8,7 +8,7 @@
%%% @end %%% @end
-module(zx_key). -module(zx_key).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -10,7 +10,7 @@
%%% @end %%% @end
-module(zx_lib). -module(zx_lib).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -6,7 +6,7 @@
%%% @end %%% @end
-module(zx_local). -module(zx_local).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -5,7 +5,7 @@
%%% @end %%% @end
-module(zx_net). -module(zx_net).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -8,7 +8,7 @@
%%% @end %%% @end
-module(zx_peer). -module(zx_peer).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -9,7 +9,7 @@
%%% @end %%% @end
-module(zx_peer_man). -module(zx_peer_man).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -6,7 +6,7 @@
%%% @end %%% @end
-module(zx_peer_sup). -module(zx_peer_sup).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -10,7 +10,7 @@
%%% @end %%% @end
-module(zx_peers). -module(zx_peers).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -5,7 +5,7 @@
%%% @end %%% @end
-module(zx_proxy). -module(zx_proxy).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -5,7 +5,7 @@
%%% @end %%% @end
-module(zx_sup). -module(zx_sup).
-vsn("0.2.1"). -vsn("0.3.0").
-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>").

View File

@ -6,7 +6,7 @@
%%% @end %%% @end
-module(zx_tty). -module(zx_tty).
-vsn("0.2.1"). -vsn("0.3.0").
-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").

View File

@ -7,7 +7,7 @@
%%% @end %%% @end
-module(zx_zsp). -module(zx_zsp).
-vsn("0.2.1"). -vsn("0.3.0").
-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").
@ -292,11 +292,10 @@ resign(_, _, _) ->
resign2(Realm, KeyName, Key, MetaBin, TarGZ) -> resign2(Realm, KeyName, Key, MetaBin, TarGZ) ->
case zx_lib:b_to_ts(MetaBin) of case zx_lib:b_to_ts(MetaBin) of
{ok, Meta} -> resign3(Realm, KeyName, Key, Meta, TarGZ); {ok, Meta} -> resign3(Realm, KeyName, Key, Meta, TarGZ);
{ok, _} -> {error, bad_realm};
error -> {error, bad_zsp} error -> {error, bad_zsp}
end. end.
resign3(Realm, KeyName, Key, Meta = #{package_id = {_, Name, Version}}, TarGZ) -> resign3(Realm, KeyName, Key, Meta = #{package_id := {_, Name, Version}}, TarGZ) ->
NewMeta = Meta#{package_id := {Realm, Name, Version}, key_name := KeyName}, NewMeta = Meta#{package_id := {Realm, Name, Version}, key_name := KeyName},
MetaBin = term_to_binary(NewMeta), MetaBin = term_to_binary(NewMeta),
MetaSize = byte_size(MetaBin), MetaSize = byte_size(MetaBin),

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
if [ -f "$HOME/.bash_profile" ]
then
. "$HOME"/.bash_profile . "$HOME"/.bash_profile
fi
export ZOMP_DIR="${ZOMP_DIR:-$HOME/zomp}" 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"

View File

@ -1,6 +1,10 @@
#!/bin/sh #!/bin/sh
if [ -f "$HOME/.bash_profile" ]
then
. "$HOME"/.bash_profile . "$HOME"/.bash_profile
fi
export ZOMP_DIR="${ZOMP_DIR:-$HOME/zomp}" 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"