summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Terceiro <antonio.terceiro@linaro.org>2013-06-11 11:44:03 -0300
committerLars Wirzenius <liw@liw.fi>2013-07-14 17:03:28 +0100
commit3520e4d1f4ef05386e4a3b12e66cd7b0dc7e327d (patch)
treecbca2b6990be7d46e871e0b0ccd0cfb7bdb7d5a4
parentaab83d8d7d5aad539444c882c174443b04f7db6a (diff)
downloadvmdebootstrap-3520e4d1f4ef05386e4a3b12e66cd7b0dc7e327d.tar.gz
clean up APT cache after installing packages
This will significantly increase the compression rate of generated images
-rwxr-xr-xvmdebootstrap5
1 files changed, 5 insertions, 0 deletions
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')