第10章 自解压发行版

原文链接  https://erlang.mk/guide/sfx.html

 

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.

Erlang.mk允许您将Relx生成的发行版打包为自解压文件。 这些压缩包包含发行版中的所有文件,以脚本的形式提取并自动运行发行版。

 

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

这样你就可以将发行版打包为一个可以执行的文件。

 

This feature is currently experimental. Feedback is much appreciated.

这项功能目前是实验性的,所有反馈我们都非常感谢。

 

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:

为了生成一个自解压发行版,你只需要在构建发行版时将 SFX=1变量传递给Make:

$ 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.

这将创建一个子解压文件$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.

自解压脚本当前仅支持以控制台模式启动发行版。

转载于:https://my.oschina.net/u/258912/blog/1604274

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值