Added a bundle to download and untar a file

This commit is contained in:
Tobias Herre 2023-10-17 08:50:04 +02:00
parent 0903c9dc9b
commit 2215b75985
1 changed files with 32 additions and 0 deletions

32
lib.cf
View File

@ -117,3 +117,35 @@ body contain wmde_cmd_useshell
useshell=>"useshell";
}
bundle agent download_and_untar(
name,
sync_src,
sync_dst,
install_dir,
test_file
)
{
classes:
"$(name)_untar" expression => not(fileexists("$(test_file)"));
files:
"$(sync_dst)"
copy_from => sync_cp("$(sync_src)","$(sys.policy_hub)"),
handle => "$(name)_tgz_copied",
classes => if_repaired ("$(name)_untar"),
perms => m(644);
commands:
"$(name)_untar"::
"/usr/bin/tar"
args => "xzvf $(sync_dst) -C $(install_dir)",
depends_on => {"$(name)_tgz_copied"},
handle => "$(name)_untarred";
reports:
# "TESTFILE: $(test_file)";
}