From 2215b759853cd260c6f42a78565267621fb94a05 Mon Sep 17 00:00:00 2001 From: Tobias Herre Date: Tue, 17 Oct 2023 08:50:04 +0200 Subject: [PATCH] Added a bundle to download and untar a file --- lib.cf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib.cf b/lib.cf index 7e08533..d787ac4 100644 --- a/lib.cf +++ b/lib.cf @@ -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)"; + +} +