docs: @Override
      public  File writeScriptTempFile(
              final ExecutionContext context,
              final File original,
              final InputStream input,
              final String script,
              final INodeEntry node,
              final File destination,
              final boolean expandTokens
      ) throws FileCopierException
      {
          final Framework framework = context.getFramework();
  
          //create new dataContext with the node data, and write the script (file,
          // content or strea) to a temp file
          //using the dataContext for substitution.
          final MultiDataContext<ContextView, DataContext> sharedContext = new WFSharedContext(context.getSharedDataContext());
          sharedContext.merge(
                  ContextView.node(node.getNodename()),
                  new BaseDataContext("node", DataContextUtils.nodeData(node))
          );
  
  
          final File tempfile;
          ScriptfileUtils.LineEndingStyle style = ScriptfileUtils.lineEndingStyleForNode(node);
  
          try {
              if (null == destination) {
                  tempfile = ScriptfileUtils.createTempFile(framework);
              } else {
                  tempfile = destination;
              }
              if (null != original) {
                  //don't replace tokens
                  try (FileInputStream in = new FileInputStream(original)) {
                      try (FileOutputStream out = new FileOutputStream(tempfile)) {
                          Streams.copyStream(in, out);
                      }
                  }
              } else if (null != script) {
                  if (expandTokens) {
                      SharedDataContextUtils.replaceTokensInScript(
                              script,
                              sharedContext,
                              style,
                              tempfile,
                              node.getNodename()
                      );
                  } else {
                      ScriptfileUtils.writeScriptFile(null, script, null, style, tempfile);
                  }
              } else if (null != input) {
                  if (expandTokens) {
                      SharedDataContextUtils.replaceTokensInStream(
                              input,
                              sharedContext,
                              style,
                              tempfile,
                              node.getNodename()
                      );
                  } else {
                      ScriptfileUtils.writeScriptFile(input, null, null, style, tempfile);
                  }
              } else {
                  return null;
              }
          } catch (IOException e) {
              throw new FileCopierException(
                      "error writing script to tempfile: " + e.getMessage(),
                      StepFailureReason.IOFailure, e
              );
          }
          try {
              ScriptfileUtils.setExecutePermissions(tempfile);
          } catch (IOException e) {
              System.err.println(
                      "Failed to set execute permissions on tempfile, execution may fail: " +
                      tempfile.getAbsolutePath()
              );
          }
          return tempfile;
      }