第10章 自解壓發行版

原文連接  https://erlang.mk/guide/sfx.htmlhtml

 

Chapter 10. Self-extracting releases

 

Erlang.mk allows you to package Relx releases as self-extracting archives. These archives contain all the files in the release and come in the form of a script that will extract and run the release automatically.shell

Erlang.mk容許您將Relx生成的發行版打包爲自解壓文件。 這些壓縮包包含發行版中的全部文件,以腳本的形式提取並自動運行發行版。app

 

This allows you to package the release as a single file that can then be executed.ide

這樣你就能夠將發行版打包爲一個能夠執行的文件。ui

 

This feature is currently experimental. Feedback is much appreciated.spa

這項功能目前是實驗性的,全部反饋咱們都很是感謝。.net

 

10.1. Generating the self-extracting archive

10.1. 生成自解壓文件

 

To generate a self-extracting release, all you need to do is pass the SFX=1 variable to Make when you build the release:code

爲了生成一個自解壓發行版,你只須要在構建發行版時將 SFX=1變量傳遞給Make:orm

$ make SFX=1

 

This will create a self-extracting archive in $RELX_OUTPUT_DIR/<name>.run. For example if the release is named hello_world and $RELX_OUTPUT_DIR is the default, the file will be located at _rel/hello_world.run.htm

這將建立一個子解壓文件$RELX_OUTPUT_DIR/<name>.run。例如,發行版命名爲hello_world而且使用默認的$RELX_OUTPUT_DIR,生成的文件就是_rel/hello_world.run

 

10.2. Running the release

10.2. 運行發行版

 

Simply execute the script to get started:

只需執行以下命令便可:

$ ./_rel/hello_world.run
Exec: /tmp/tmp.3eeEq7E1ta/erts-8.1/bin/erlexec ...
Root: /tmp/tmp.3eeEq7E1ta
/tmp/tmp.3eeEq7E1ta
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] ...

Eshell V8.1  (abort with ^G)
(hello_world@localhost)1>

 

As you can see the archive is extracted to a temporary directory before the release can be started.

如你所見,在發行版運行前,先將壓縮包解壓到一個臨時目錄。

 

The self-extracting script currently only supports starting the release in console mode.

自解壓腳本當前僅支持以控制檯模式啓動發行版。

相關文章
相關標籤/搜索