From 63e1b902670d78f62cd75c1d154bcbd2fd6e15ae Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Fri, 4 Jan 2013 13:17:24 +0200 Subject: [PATCH] In rsync make src and dest labels configurable --- image_creator/bundle_volume.py | 2 +- image_creator/rsync.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/image_creator/bundle_volume.py b/image_creator/bundle_volume.py index ff4861e..e86d613 100644 --- a/image_creator/bundle_volume.py +++ b/image_creator/bundle_volume.py @@ -385,7 +385,7 @@ class BundleVolume(object): rsync.exclude(excl) rsync.archive().hard_links().xattrs().sparse().acls() - rsync.run('/', target) + rsync.run('/', target, 'host', 'tmp image') # We need to replace the old UUID referencies with the new # ones in grub configuration files and /etc/fstab for file diff --git a/image_creator/rsync.py b/image_creator/rsync.py index 9ae22b6..16f3c63 100644 --- a/image_creator/rsync.py +++ b/image_creator/rsync.py @@ -82,7 +82,7 @@ class Rsync: self._exclude = [] self._options = ['-v'] - def run(self, src, dest): + def run(self, src, dest, slabel='source', dlabel='destination'): """Run the actual command""" cmd = [] cmd.append('rsync') @@ -90,7 +90,8 @@ class Rsync: for i in self._exclude: cmd.extend(['--exclude', i]) - self._out.output("Calculating total number of host files ...", False) + self._out.output("Calculating total number of %s files ..." % slabel, + False) # If you don't specify a destination, rsync will list the source files. dry_run = subprocess.Popen(cmd + [src], shell=False, @@ -106,8 +107,8 @@ class Rsync: self._out.success("%d" % total) - progress = self._out.Progress(total, - "Copying host files into the image") + progress = self._out.Progress(total, "Copying %s files to %s" % + (slabel, dlabel)) run = subprocess.Popen(cmd + [src, dest], shell=False, stdout=subprocess.PIPE, bufsize=0) try: -- 1.7.10.4