From 2404e1f25863e81bca0aea63e8c2b8a29835d56c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 15 Nov 2024 13:36:50 +0100 Subject: [PATCH] Example --- scriptify | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scriptify diff --git a/scriptify b/scriptify new file mode 100644 index 000000000000..32fc5d4bd1f9 --- /dev/null +++ b/scriptify @@ -0,0 +1,16 @@ +#!/usr/bin/env escript + +-define(SHEBANG, "/usr/bin/env escript"). +-define(COMMENT, ""). +-define(EMU_ARGS, "-noinput +B -sasl errlog_type error -escript main "). + +main([Name | Beams]) -> + BeamData = [{filename:basename(B), read(B)}|| B <- Beams], + ok = escript:create(Name, [{archive, BeamData, [memory]}, + {shebang, ?SHEBANG}, + {comment, ?COMMENT}, + {emu_args, ?EMU_ARGS ++ Name}]), + ok = file:change_mode(Name, 8#755). +read(File) -> + {ok, B} = file:read_file(filename:absname(File)), + B.