body file control
{
  inputs => { "$(sys.policy_entry_dirname)/../common.cf.sub" };
}

bundle common testcase
{
  vars:
    "filename" string => "$(this.promise_filename)";
}

bundle agent setup
{
  files:
    "$(G.testroot)/TEST.source"
      depth_search => recurse("inf"),
      copy_from => example("$(this.promise_dirname)/test_files");
}

bundle agent main
{
  files:
    "$(G.testroot)/TEST.destination/subdir/." create => "true";

    "$(G.testroot)/TEST.destination/file-perms-644"
      copy_from => example2("$(G.testroot)/TEST.source/file-perms-644");

    "$(G.testroot)/TEST.destination/subdir/subfile"
      copy_from => example2("$(G.testroot)/TEST.source/subdir/subdir-file");
}

body copy_from example(from)
{
  source => "$(from)";
  compare => "digest";
  preserve => "true";
}

body copy_from example2(from)
{
  source => "$(from)";
  compare => "mtime";
  check_root => "true";
  copy_backup => "timestamp";
}
