From 4efe8553da4ccf4ec58197bb1422eefa9713e908 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 10 Feb 2014 21:40:11 +0100 Subject: [PATCH] run apt-get clean before creating preos Signed-off-by: Nico Schottelius --- cdist/preos.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cdist/preos.py b/cdist/preos.py index 347b0cba..ff157f5b 100644 --- a/cdist/preos.py +++ b/cdist/preos.py @@ -162,6 +162,10 @@ cp -L "$src" "$real_dst" fd.write(val) os.chmod(filename, stat.S_IRUSR | stat.S_IXUSR) + def remove_archives(self, base_dir): + cmd = [ "chroot", self.target_dir, "/usr/bin/apt-get", "clean" ] + subprocess.check_call(cmd) + def create_kernel(self): dst = os.path.join(self.out_dir, "kernel") srcglob = glob.glob("%s/boot/vmlinuz-*" % self.target_dir) @@ -270,6 +274,9 @@ cp -L "$src" "$real_dst" if args.config: self.config() + # Cleanup archives before creating any image + self.remove_archives() + # Output pxe files if args.pxe_boot_dir: self.create_pxe(args.pxe_boot_dir)