WIP: Windows install/starup tweaks
This commit is contained in:
parent
9f1763ec1c
commit
4e3c5d7202
@ -27,7 +27,8 @@ main(_) ->
|
|||||||
|
|
||||||
unpack(OS, ZompDir) ->
|
unpack(OS, ZompDir) ->
|
||||||
BaseDir = filename:dirname(ZompDir),
|
BaseDir = filename:dirname(ZompDir),
|
||||||
ok = erl_tar:extract("zomp.tar.gz", [compressed, {cwd, BaseDir}]),
|
{ok, Files} = zip:extract("zomp.zip", [{cwd, BaseDir}]),
|
||||||
|
ok = io:format("Extracted: ~tp~n", [Files]),
|
||||||
add_launcher(OS, ZompDir).
|
add_launcher(OS, ZompDir).
|
||||||
|
|
||||||
|
|
||||||
@ -37,13 +38,13 @@ unpack(OS, ZompDir) ->
|
|||||||
ZompDir :: file:filename().
|
ZompDir :: file:filename().
|
||||||
|
|
||||||
add_launcher({unix, linux}, ZompDir) ->
|
add_launcher({unix, linux}, ZompDir) ->
|
||||||
add_unix_link(ZompDir),
|
ok = add_unix_link(ZompDir),
|
||||||
halt(0);
|
halt(0);
|
||||||
add_launcher({unix, _}, ZompDir) ->
|
add_launcher({unix, _}, ZompDir) ->
|
||||||
add_unix_link(ZompDir),
|
ok = add_unix_link(ZompDir),
|
||||||
halt(0);
|
halt(0);
|
||||||
add_launcher({win32, nt}, _ZompDir) ->
|
add_launcher({win32, nt}, ZompDir) ->
|
||||||
ok = io:format("This is going to be a bit of a rodeo...~n"),
|
ok = add_windows_link(ZompDir),
|
||||||
halt(0).
|
halt(0).
|
||||||
|
|
||||||
|
|
||||||
@ -52,15 +53,15 @@ add_launcher({win32, nt}, _ZompDir) ->
|
|||||||
|
|
||||||
add_unix_link(ZompDir) ->
|
add_unix_link(ZompDir) ->
|
||||||
Home = filename:dirname(ZompDir),
|
Home = filename:dirname(ZompDir),
|
||||||
Link = filename:join(Home, "bin/zx"),
|
Link = filename:join(Home, "bin/zx"),
|
||||||
LinkH = filename:join(Home, "bin/zxh"),
|
LinkH = filename:join(Home, "bin/zxh"),
|
||||||
HomeBin = filename:dirname(Link),
|
HomeBin = filename:dirname(Link),
|
||||||
Target = filename:join(ZompDir, "zx"),
|
Target = filename:join(ZompDir, "zx"),
|
||||||
TargetH = filename:join(ZompDir, "zxh"),
|
TargetH = filename:join(ZompDir, "zxh"),
|
||||||
ok = filelib:ensure_dir(Link),
|
ok = filelib:ensure_dir(Link),
|
||||||
LinkCommand = "env LANG=en ln -s " ++ Target ++ " " ++ Link,
|
LinkCommand = "env LANG=en ln -s " ++ Target ++ " " ++ Link,
|
||||||
LinkCommandH = "env LANG=en ln -s " ++ TargetH ++ " " ++ LinkH,
|
LinkCommandH = "env LANG=en ln -s " ++ TargetH ++ " " ++ LinkH,
|
||||||
ModeCommand = "env LANG=en chmod +x " ++ Target,
|
ModeCommand = "env LANG=en chmod +x " ++ Target,
|
||||||
ModeCommandH = "env LANG=en chmod +x " ++ TargetH,
|
ModeCommandH = "env LANG=en chmod +x " ++ TargetH,
|
||||||
ok = os_cmd(LinkCommand),
|
ok = os_cmd(LinkCommand),
|
||||||
ok = os_cmd(LinkCommandH),
|
ok = os_cmd(LinkCommandH),
|
||||||
@ -86,6 +87,27 @@ add_unix_link(ZompDir) ->
|
|||||||
io:format(Message, [Target, Link, HomeBin]).
|
io:format(Message, [Target, Link, HomeBin]).
|
||||||
|
|
||||||
|
|
||||||
|
-spec add_windows_link(ZompDir) -> ok
|
||||||
|
when ZompDir :: file:filename().
|
||||||
|
|
||||||
|
add_windows_link(ZompDir) ->
|
||||||
|
Home = filename:join(os:getenv("HOMEDRIVE"), os:getenv("HOMEPATH")),
|
||||||
|
Launcher = filename:join(ZompDir, "zx.cmd"),
|
||||||
|
LauncherH = filename:join(ZompDir, "zxh.cmd"),
|
||||||
|
Vapor = filename:join(ZompDir, "vapor.cmd"),
|
||||||
|
Target = filename:join(Home, "zx.cmd"),
|
||||||
|
TargetH = filename:join(Home, "zxh.cmd"),
|
||||||
|
VaporL = filename:join([Home, "Desktop", "Vapor.cmd"]),
|
||||||
|
{ok, _} = file:copy(Launcher, Target),
|
||||||
|
{ok, _} = file:copy(LauncherH, TargetH),
|
||||||
|
{ok, _} = file:copy(Vapor, VaporL),
|
||||||
|
Message =
|
||||||
|
"`zx` and `zxh` launch scripts have been added to ~p~n"
|
||||||
|
"(available from cmd.exe in your home directory)~n"
|
||||||
|
"A GUI program launcher script has been added to the desktop.~n",
|
||||||
|
io:format(Message, [Home]).
|
||||||
|
|
||||||
|
|
||||||
-spec os_cmd(Command :: string()) -> ok.
|
-spec os_cmd(Command :: string()) -> ok.
|
||||||
|
|
||||||
os_cmd(Command) ->
|
os_cmd(Command) ->
|
||||||
|
|||||||
16
packup
16
packup
@ -5,18 +5,18 @@
|
|||||||
main(_) ->
|
main(_) ->
|
||||||
{ok, BV} = file:read_file("zomp/etc/version.txt"),
|
{ok, BV} = file:read_file("zomp/etc/version.txt"),
|
||||||
Version = string:strip(binary_to_list(BV), both, $\n),
|
Version = string:strip(binary_to_list(BV), both, $\n),
|
||||||
Tar = "zomp.tar.gz",
|
Inner = "zomp.zip",
|
||||||
ok = erl_tar:create(Tar, ["zomp"], [compressed]),
|
Outer = "zx-" ++ Version ++ ".zip",
|
||||||
Zip = "zx-" ++ Version ++ ".zip",
|
{ok, Inner} = zip:create(Inner, ["zomp"]),
|
||||||
ZipFiles =
|
Files =
|
||||||
["install.escript",
|
["install.escript",
|
||||||
"install_unix",
|
"install_unix",
|
||||||
"uninstall_unix",
|
"uninstall_unix",
|
||||||
"README.md",
|
"README.md",
|
||||||
"README.install",
|
"README.install",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
Tar],
|
Inner],
|
||||||
{ok, Zip} = zip:create(Zip, ZipFiles),
|
{ok, Outer} = zip:create(Outer, Files),
|
||||||
ok = file:delete(Tar),
|
ok = file:delete(Inner),
|
||||||
ok = io:format("~ts~n", [Zip]),
|
ok = io:format("~ts~n", [Outer]),
|
||||||
halt(0).
|
halt(0).
|
||||||
|
|||||||
1
vapor.cmd
Normal file
1
vapor.cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
start /min cmd.exe /c "%HOMEDRIVE%%HOMEPATH%\zx" run vapor
|
||||||
6
zomp/zx
6
zomp/zx
@ -11,6 +11,10 @@ export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
|||||||
|
|
||||||
start_dir="$PWD"
|
start_dir="$PWD"
|
||||||
cd "$ZX_DIR"
|
cd "$ZX_DIR"
|
||||||
./make_zx
|
if [ ! -f ebin/zx.erl ]
|
||||||
|
then
|
||||||
|
chmod +x make_zx
|
||||||
|
./make_zx
|
||||||
|
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 $@
|
||||||
|
|||||||
14
zomp/zx.cmd
14
zomp/zx.cmd
@ -1,9 +1,13 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
REM Prepare the environment for ZX and launch it
|
REM Prepare the environment for ZX and launch it
|
||||||
|
|
||||||
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
||||||
set /P VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
set ZOMP_DIR=%ZOMP_DIR:"=%
|
||||||
set ZX_DIR="%ZOMP_DIR%\lib\otpr\zx\%VERSION%"
|
set /P ZX_VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||||
pushd %ZX_DIR%
|
set ZX_DIR=%ZOMP_DIR%\lib\otpr\zx\%ZX_VERSION%
|
||||||
escript.exe make_zx
|
set ZX_DIR=%ZX_DIR:"=%
|
||||||
|
pushd "%ZX_DIR%"
|
||||||
|
if not exist ebin\zx.erl "C:\Program Files\erl10.6\bin\escript.exe" make_zx
|
||||||
popd
|
popd
|
||||||
erl.exe -pa "%ZX_DIR%/ebin" -run zx run "%*"
|
"C:\Program Files\erl10.6\bin\erl.exe" -noshell -pa "%ZX_DIR%/ebin" -run zx do -extra %*
|
||||||
|
|||||||
8
zomp/zxh
8
zomp/zxh
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -f "$HOME/.bash_profile" ]
|
if [ -f "$HOME/.bash_profile" ]
|
||||||
then
|
then
|
||||||
@ -11,6 +11,10 @@ export ZX_DIR="$ZOMP_DIR/lib/otpr/zx/$ZX_VERSION"
|
|||||||
|
|
||||||
start_dir="$PWD"
|
start_dir="$PWD"
|
||||||
cd "$ZX_DIR"
|
cd "$ZX_DIR"
|
||||||
./make_zx
|
if [ ! -f ebin/zx.erl ]
|
||||||
|
then
|
||||||
|
chmod +x make_zx
|
||||||
|
./make_zx
|
||||||
|
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 $@
|
||||||
|
|||||||
14
zomp/zxh.cmd
14
zomp/zxh.cmd
@ -1,9 +1,13 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
REM Prepare the environment for ZX and launch it
|
REM Prepare the environment for ZX and launch it
|
||||||
|
|
||||||
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
set ZOMP_DIR="%LOCALAPPDATA%\zomp"
|
||||||
set /P VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
set ZOMP_DIR=%ZOMP_DIR:"=%
|
||||||
set ZX_DIR="%ZOMP_DIR%\lib\otpr\zx\%VERSION%"
|
set /P ZX_VERSION=<"%ZOMP_DIR%\etc\version.txt"
|
||||||
pushd %ZX_DIR%
|
set ZX_DIR=%ZOMP_DIR%\lib\otpr\zx\%ZX_VERSION%
|
||||||
escript.exe make_zx
|
set ZX_DIR=%ZX_DIR:"=%
|
||||||
|
pushd "%ZX_DIR%"
|
||||||
|
if not exist ebin\zx.erl "C:\Program Files\erl10.6\bin\escript.exe" make_zx
|
||||||
popd
|
popd
|
||||||
erl.exe -pa "%ZX_DIR%/ebin" -run zx run "%*"
|
"C:\Program Files\erl10.6\bin\werl.exe" -pa "%ZX_DIR%/ebin" -run zx do -extra %*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user