From: Antonio Terceiro Date: Tue, 11 Jun 2013 14:44:03 +0000 (-0300) Subject: clean up APT cache after installing packages X-Git-Url: https://git.siccegge.de//index.cgi?p=forks%2Fvmdebootstrap.git;a=commitdiff_plain;h=3520e4d1f4ef05386e4a3b12e66cd7b0dc7e327d clean up APT cache after installing packages This will significantly increase the compression rate of generated images --- 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')