4
votes

I'm looking at the way a self-contained script is created out of the rebar Erlang application. Essentially, a bootstrap script takes care of loading and compressing all files from ebin and priv into memory, to finally write them into the self-contained "rebar" script.

I kinda like the approach and I'm thinking if it would be easily possible the same concept to Erlang releases.

  1. Would it make sense to have a self-contained script for an Erlang release?
  2. Does this exist somewhere out there, already?
  3. One of the things this potential "release-bootstrap" file should do is to take care of application dependencies and so on. Would it be possible to re-use what already exist in the Erlang distribution, without re-inventing the wheel?
  4. Are there any gotchas to keep in mind, when trying to achieve a self-contained script for an Erlang release?
1
self contained as in no need to install the VM on the machine?Lukas
I suppose that would be a bit too extreme. No, the script should rely on Erlang installed on the target machine. But I guess it would be a mess to deal with version numbers for the applications. It would be great to be able to specify a minimum version number for each application to be required.Roberto Aloi
That sounds exactly like what releases are for.I GIVE TERRIBLE ADVICE
But they're not self-contained. Are they?Roberto Aloi
I know how releases work and in which terms they are 'self contained'. What I was thinking about was a single, executable, file like the rebar one.Roberto Aloi

1 Answers

4
votes

Have a look at the escript docs (escript module). What you essentially do, is zip up a bunch of applications in a directory structure (much as a release) than convert that file to an escript by appending a escript header to the zip file and rename it.

http://www.erlang.org/doc/man/escript.html