commit f72b094034c86f56d74ca8de41d4c3b986376d47
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Tue Jan 11 11:26:55 2011 +0000
made rsync optional with -r or --rsync
multiboot-media-creator.py | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index d458be2..34ec61a 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -33,6 +33,8 @@ parser.add_option("-d", "--destination",
dest="device",
help="USB device to create media", metavar="USB")
parser.add_option("-j", "--justdoit", action="store_true",
dest="justdoit", default=False,
help="Attempt to build without intervention - be careful")
+parser.add_option("-r", "--rsync", action="store_true",
dest="rsync", default=False,
+ help="Use rsync instead of shutil.copy2. This uses system calls,
and carries and additional overhead")
(options, args) = parser.parse_args()
#print options.directory
@@ -116,7 +118,10 @@ def build_filesystem():
BN=os.path.basename(i.strip(".iso"))
makedirs(i, "live")
tree_path=mount_iso(i)
- shutil.copytree(tree_path,os.path.join(mytemp, BN,"images/"))
+ if options.rsync==False:
+ shutil.copytree(tree_path,os.path.join(mytemp, BN,"images/"))
+ else:
+ os.system("rsync -avH --progress %s %s" %
(tree_path,os.path.join(mytemp, BN,"images/"))
umount_iso(i)
except:
print "No live isos found"
@@ -126,14 +131,16 @@ def build_filesystem():
BN=os.path.basename(i.strip(".iso"))
makedirs(i, "dvd")
tree_path=mount_iso(i)
-# shutil.copy2(os.path.join(tree_path,
"isolinux/vmlinuz"),os.path.join(mytemp, BN,"boot/"))
- os.system("rsync -avH --progress %s %s" % (os.path.join(tree_path,
"isolinux/vmlinuz"),os.path.join(mytemp, BN,"boot/")))
-# shutil.copy2(os.path.join(tree_path,
"isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/"))
- os.system("rsync -avH --progress %s %s" % (os.path.join(tree_path,
"isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/")))
-# shutil.copy2(os.path.join(tree_path,
"images/install.img"),os.path.join(mytemp, BN,"images/"))
- os.system("rsync -avH --progress %s %s" % (os.path.join(tree_path,
"isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/")))
-# shutil.copy2(i,os.path.join(mytemp, BN))
- os.system("rsync -avH --progress %s %s" % (i,os.path.join(mytemp,
BN)))
+ if options.rsync==False:
+ shutil.copy2(os.path.join(tree_path,
"isolinux/vmlinuz"),os.path.join(mytemp, BN,"boot/"))
+ shutil.copy2(os.path.join(tree_path,
"isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/"))
+ shutil.copy2(os.path.join(tree_path,
"images/install.img"),os.path.join(mytemp, BN,"images/"))
+ shutil.copy2(i,os.path.join(mytemp, BN))
+ else:
+ os.system("rsync -avH --progress %s %s" %
(os.path.join(tree_path, "isolinux/vmlinuz"),os.path.join(mytemp,
BN,"boot/")))
+ os.system("rsync -avH --progress %s %s" %
(os.path.join(tree_path, "isolinux/initrd.img"),os.path.join(mytemp,
BN,"boot/")))
+ os.system("rsync -avH --progress %s %s" %
(os.path.join(tree_path, "isolinux/initrd.img"),os.path.join(mytemp,
BN,"boot/")))
+ os.system("rsync -avH --progress %s %s" %
(i,os.path.join(mytemp, BN)))
umount_iso(i)
except:
print "No dvd isos found"