anchor.diff:                          include_nodetool(BinDir),
                           Hooks = expand_hooks(BinDir,
                                                rlx_state:get(State,
  -                                                           extended_start_script_hooks, [])),
  +                                                           extended_start_script_hooks, []),
  +                                             State),
                           extended_bin_file_contents(OsFamily, RelName, RelVsn,
                                                      rlx_release:erts(Release), ErlOpts,
                                                      Hooks)
  
positive.code:             E
      end.
  
  expand_hooks(_Bindir, []) -> [];
  expand_hooks(BinDir, Hooks) ->
      expand_hooks(BinDir, Hooks, []).
  
  expand_hooks(_BinDir, [], Acc) -> Acc;
  expand_hooks(BinDir, [{Phase, Hooks0} | Rest], Acc) ->
      %% filter and expand hooks to their respective shell scripts
      Hooks =
          lists:foldl(
  
negative.code:                         HookScriptFilename = filename:join([BinDir,
                                                              hook_filename(Hook)]),
                          %% write the hook script file to it's proper location
                          ok = render_hook(hook_template(Hook), HookScriptFilename, State),
                          %% and return the invocation that's to be templated in the
                          %% extended script
                          Acc0 ++ [hook_invocation(Hook)];
                      false ->
                          ec_cmd_log:error(
                              rlx_state:log(State),
                              io_lib:format("~p hook is not allowed in the ~p phase, ignoring it", [Hook, Phase])
                          ),
  
                          Acc0
                  end
              end, [], Hooks0),
      expand_hooks(BinDir, Rest, Acc ++ [{Phase, Hooks}], State).
  
  %% the pid script hook is only allowed in the
  %% post_start phase
  