From 3520e4d1f4ef05386e4a3b12e66cd7b0dc7e327d Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 11 Jun 2013 11:44:03 -0300 Subject: [PATCH] clean up APT cache after installing packages This will significantly increase the compression rate of generated images --- vmdebootstrap | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vmdebootstrap b/vmdebootstrap index f857bac..5b4fa96 100755 --- a/vmdebootstrap +++ b/vmdebootstrap @@ -107,6 +107,7 @@ class VmDebootstrap(cliapp.Application): self.set_hostname(rootdir) self.create_fstab(rootdir) self.install_debs(rootdir) + self.cleanup_apt_cache(rootdir) self.set_root_password(rootdir) self.create_users(rootdir) self.remove_udev_persistent_rules(rootdir) @@ -251,6 +252,10 @@ class VmDebootstrap(cliapp.Application): logging.debug('stdout:\n%s' % out) shutil.rmtree(tmp) + def cleanup_apt_cache(self, rootdir): + out = self.runcmd(['chroot', rootdir, 'apt-get', 'clean']) + logging.debug('stdout:\n%s' % out) + def set_root_password(self, rootdir): if self.settings['root-password']: self.message('Setting root password') -- 2.39.2