From 66c2192c43bcb5f18eb950ad1c8a6ddafa8e798c Mon Sep 17 00:00:00 2001 From: Gwendal Laurent <44499033+GwendalLaurent@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:41:44 +0100 Subject: [PATCH] update templates of `rebar3 grisp configure` for grisp.io (#90) * update templates * update template to support updates and reboot * signature options --- priv/templates/common/rebar.config | 7 ++++++- priv/templates/common/sys.config | 14 +++++++++++++- priv/templates/network/grisp.ini.mustache | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/priv/templates/common/rebar.config b/priv/templates/common/rebar.config index 103f676..7bfc056 100644 --- a/priv/templates/common/rebar.config +++ b/priv/templates/common/rebar.config @@ -1,5 +1,6 @@ {deps, [ - {{^grisp_io}}grisp{{/grisp_io}}{{#grisp_io}}{grisp_connect, {git, "https://github.com/grisp/grisp_connect", {branch, "main"}}}{{/grisp_io}}{{^epmd}} + {{^grisp_io}}grisp{{/grisp_io}}{{#grisp_io}}{grisp_connect, "1.0.0"}, + grisp_updater_grisp2{{/grisp_io}}{{^epmd}} {{/epmd}}{{#epmd}}, {epmd, {git, "https://github.com/erlang/epmd", {ref, "4d1a59"}}} {{/epmd}} @@ -25,6 +26,10 @@ {{#epmd}} {epmd, none}, {{/epmd}} + {{#grisp_io}} + {grisp_updater_grisp2, load}, + sasl, + {{/grisp_io}} {{{name}}} ]} ]}. diff --git a/priv/templates/common/sys.config b/priv/templates/common/sys.config index 9299386..6bff544 100644 --- a/priv/templates/common/sys.config +++ b/priv/templates/common/sys.config @@ -2,6 +2,18 @@ {{#grisp_io_linking}} {grisp_connect,[ {device_linking_token,<<"{{{token}}}">>} ]}, -{{/grisp_io_linking}} {{{{name}}}, [ +{{/grisp_io_linking}} +{{#grisp_io}} {grisp_updater, [ + {signature_check, false}, % Set to 'true' and uncomment next line to enable signature check + % {signature_certificates, {priv, grisp_demo, "certificates/updates"}}, + {system, {grisp_updater_grisp2, #{}}}, + {sources, [ + {grisp_updater_tarball, #{}}, + {grisp_updater_http, #{ + backend => {grisp_updater_grisp2, #{}} + }} + ]} + ]}, +{{/grisp_io}} {{{{name}}}, [ ]} ]. diff --git a/priv/templates/network/grisp.ini.mustache b/priv/templates/network/grisp.ini.mustache index cd6d420..baf984c 100644 --- a/priv/templates/network/grisp.ini.mustache +++ b/priv/templates/network/grisp.ini.mustache @@ -2,6 +2,8 @@ [erlang] args = erl.rtems -C multi_time_warp -- -mode embedded -home . -pa . -root {{release_name}} -bindir {{release_name}}/erts-{{erts_vsn}}/bin -boot {{release_name}}/releases/{{release_version}}/start -config {{release_name}}/releases/{{release_version}}/sys.config <%#network%>-kernel inetrc "./erl_inetrc"<%/network%> <%#epmd%>-internal_epmd epmd_sup -sname {{release_name}} -setcookie <%={{ }}=%> {{{cookie}}} {{=<% %>=}} <%/epmd%> shell = erlang +on_exit = reboot +on_crash = reboot [network] ip_self=dhcp