[multiboot-media-creator/python-development] fixed wrongly reported device during grub installation
by Dave Riches
commit 9b780ad694a6fbaae79fa7abb1935b813b218b19
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 20 20:22:37 2011 +0000
fixed wrongly reported device during grub installation
multiboot-media-creator.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index c7b31de..f68e1d4 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -90,7 +90,7 @@ def umount_device(dev):
def grub_install():
if options.verbose==True:
- print "Installing grub to %s" % dev
+ print "Installing grub to %s" % rawdev
try:
os.system("grub2-install --root-directory=%s %s --force %s" % (mytemp,rawdev,grub2_opts))
except:
12 years, 2 months
[multiboot-media-creator/python-development] made -q --quiet work. Added a couple of deps to README for now
by Dave Riches
commit 7d3d84cdd25dc32432efc67ac82a5567d33ca794
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 20 20:18:56 2011 +0000
made -q --quiet work. Added a couple of deps to README for now
README | 7 ++++
multiboot-media-creator.py | 68 +++++++++++++++++++++++++++++++++----------
2 files changed, 59 insertions(+), 16 deletions(-)
---
diff --git a/README b/README
index 98024eb..5ff7e50 100644
--- a/README
+++ b/README
@@ -9,3 +9,10 @@ It will take all of the .iso files within the working directory.
Usage:
The result should be a Multi-Boot.iso image which can then be used, as described above
+
+Requirements
+
+Python
+pyparted
+grub2
+**more coming soon**
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 33afa93..c7b31de 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -35,6 +35,8 @@ parser.add_option("-j", "--justdoit", action="store_true", dest="justdoit", defa
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")
+parser.add_option("-u", "--update", action="store_true", dest="update", default=False,
+ help="Update an existing device, adds the isos defined in --source to the device --destination")
(options, args) = parser.parse_args()
#print options.directory
@@ -52,31 +54,49 @@ else:
mytemp=tempfile.mkdtemp(suffix=".mmc")
dev=options.device
rawdev=dev[:-1]
+if options.verbose==True:
+ rsync_opts="-avH --progress"
+ grub2_opts=""
+else:
+ rsync_opts="-aH --progress"
+ grub2_opts=">/dev/null"
if dev==None:
sys.exit("Program requires a destination device")
-print path
-print dev
+if options.verbose==True:
+ print "Path to iso directory: %s" % path
+ print "Path to device: %s " % dev
def check_device():
+ if options.verbose==True:
+ print "Checking device to see if its already in use.."
devinfo=parted.getDevice(dev)
if devinfo.busy==True:
sys.exit("The device is busy or already mounted, please check and try again")
else:
- print "Device not busy, continuing"
+ if options.verbose==True:
+ print "Device not busy, continuing"
def mount_device(dev):
+ if options.verbose==True:
+ print "Mounting device: %s" % dev
os.system("mount %s %s" % (dev, mytemp))
def umount_device(dev):
+ if options.verbose==True:
+ print "Un-mounting device: %s" % dev
os.system("umount %s" % dev)
def grub_install():
+ if options.verbose==True:
+ print "Installing grub to %s" % dev
try:
- os.system("grub2-install --root-directory=%s %s --force" % (mytemp,rawdev))
+ os.system("grub2-install --root-directory=%s %s --force %s" % (mytemp,rawdev,grub2_opts))
except:
sys.exit("Unable to grub-install, check device")
+ if options.verbose==True:
+ print "Attempting to relabel partition"
try:
os.system("e2label %s Multi-Boot" % dev)
except:
@@ -85,24 +105,27 @@ def grub_install():
def getisos(isopath,isotype):
"""getisos returns a list of isos inside a specific path
based on a given type"""
+ if options.verbose==True:
+ print "Searching for %s isos" % isotype
isopath=os.path.join(isopath, "*.iso")
isos=[]
for i in glob.glob(isopath):
os.system("mount -o loop %s %s &>/dev/null" % (i, mytemp))
if os.path.isfile(os.path.join(mytemp+"/.discinfo")) == True:
info="dvd"
- print i+" is dvd"
else:
info="live"
- print i+" is live"
os.system("umount %s &>/dev/null" % i)
if info==isotype:
isos.append(i)
return isos
def makedirs(iso,filesys):
+ if os.path.exists(os.path.join(mytemp, "boot/grub2"))==True:
+ os.exit("It seems like there is already a filesystem on that device, possibly built by mmc previously. You might want to either delete this, or use the -u --update option")
BN=os.path.basename(iso.strip(".iso"))
- os.makedirs(os.path.join(mytemp, "boot/grub2"))
+ if options.update==False:
+ os.makedirs(os.path.join(mytemp, "boot/grub2"))
os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
os.makedirs(os.path.join(mytemp, BN,"tmp"))
if filesys=="dvd":
@@ -132,7 +155,8 @@ def make_iso():
def build_filesystem():
try:
for i in getisos(path, "live"):
- print "Building filesystem for: %s" % i
+ if options.verbose==True:
+ print "Building filesystem for: %s" % i
BN=os.path.basename(i.strip(".iso"))
makedirs(i, "live")
tree_path=mount_iso(i)
@@ -142,7 +166,8 @@ def build_filesystem():
os.system("rsync -avH --progress %s %s" % (tree_path,os.path.join(mytemp, BN,"images/")))
umount_iso(i)
except:
- print "No live isos found"
+ if options.verbose==True:
+ print "No live isos found"
try:
for i in getisos(path, "dvd"):
print "Building filesystem for: %s" % i
@@ -155,14 +180,16 @@ def build_filesystem():
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)))
+ os.system("rsync %s %s %s" % (rsync_opts, os.path.join(tree_path, "isolinux/vmlinuz"),os.path.join(mytemp, BN,"boot/")))
+ os.system("rsync %s %s %s" % (rsync_opts, os.path.join(tree_path, "isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/")))
+ os.system("rsync %s %s %s" % (rsync_opts, os.path.join(tree_path, "isolinux/initrd.img"),os.path.join(mytemp, BN,"boot/")))
+ os.system("rsync %s %s %s" % (rsync_opts, i,os.path.join(mytemp, BN)))
umount_iso(i)
except:
- print "No dvd isos found"
- print "Done!"
+ if options.verbose==True:
+ print "No dvd isos found"
+ if options.verbose==True:
+ print "Done!"
def create_grub(gtimeout=10):
grub=open(os.path.join(mytemp, "boot/grub2/grub.cfg"), "w")
@@ -183,11 +210,20 @@ def create_grub(gtimeout=10):
grub.close()
def doit(device):
+ check_device()
mount_device(device)
build_filesystem()
create_grub()
grub_install()
- umount_device(dev)
+ umount_device(device)
+ removetemps()
+
+def update(device):
+ check_device()
+ mount_device(device)
+ build_filesystem(update)
+ create_grub()
+ umount_device(device)
removetemps()
if options.justdoit==True:
12 years, 2 months
[multiboot-media-creator/python-development] Script completes as prescribed, start to finish. run with -j or --justdoit for a complete run
by Dave Riches
commit 5976c8e2f45f42af866db0b443449f9d3993ce31
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Tue Jan 18 22:16:18 2011 +0000
Script completes as prescribed, start to finish. run with -j or --justdoit for a complete run
Does not work with Live isos
multiboot-media-creator.py | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 5084985..33afa93 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -51,9 +51,10 @@ else:
mytemp=tempfile.mkdtemp(suffix=".mmc")
dev=options.device
+rawdev=dev[:-1]
-#if dev==None:
-# sys.exit("Program requires a destination device")
+if dev==None:
+ sys.exit("Program requires a destination device")
print path
print dev
@@ -73,7 +74,7 @@ def umount_device(dev):
def grub_install():
try:
- os.system("grub2-install --root-directory=%s %s --force" % (mytemp,dev))
+ os.system("grub2-install --root-directory=%s %s --force" % (mytemp,rawdev))
except:
sys.exit("Unable to grub-install, check device")
try:
@@ -101,14 +102,11 @@ based on a given type"""
def makedirs(iso,filesys):
BN=os.path.basename(iso.strip(".iso"))
- try:
- os.makedirs(os.path.join(mytemp, BN,"boot"))
- os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
- os.makedirs(os.path.join(mytemp, BN,"tmp"))
- if filesys=="dvd":
- os.makedirs(os.path.join(mytemp, BN,"images"))
- except:
- sys.exit("Unable to create directory structure on device")
+ os.makedirs(os.path.join(mytemp, "boot/grub2"))
+ os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
+ os.makedirs(os.path.join(mytemp, BN,"tmp"))
+ if filesys=="dvd":
+ os.makedirs(os.path.join(mytemp, BN,"images"))
print mytemp
def mount_iso(iso):
@@ -164,7 +162,6 @@ def build_filesystem():
umount_iso(i)
except:
print "No dvd isos found"
- os.makedirs(os.path.join(mytemp, "boot/grub2"))
print "Done!"
def create_grub(gtimeout=10):
@@ -185,17 +182,14 @@ def create_grub(gtimeout=10):
grub.write(" initrd /%s/boot/initrd.img\n}\n" % BN)
grub.close()
-#if __name__=="__main__":
-# build_filesystem()
-# create_grub()
-# make_iso()
-# removetemps()
def doit(device):
mount_device(device)
build_filesystem()
create_grub()
grub_install()
umount_device(dev)
+ removetemps()
if options.justdoit==True:
doit(dev)
+
12 years, 2 months
[multiboot-media-creator/python-development] mkdirs typo
by Dave Riches
commit 6f90648cfe531f9110e873fb3bc665ff746b7455
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 13 20:22:23 2011 +0000
mkdirs typo
README | 2 +-
multiboot-media-creator.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/README b/README
index 833277a..98024eb 100644
--- a/README
+++ b/README
@@ -8,4 +8,4 @@ It will take all of the .iso files within the working directory.
Usage:
-he result should be a Multi-Boot.iso image which can then be used, as described above
+The result should be a Multi-Boot.iso image which can then be used, as described above
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 2a92c8d..5084985 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -164,7 +164,7 @@ def build_filesystem():
umount_iso(i)
except:
print "No dvd isos found"
- os.makedirs(os.path.join(mytemp, "boot/grub"))
+ os.makedirs(os.path.join(mytemp, "boot/grub2"))
print "Done!"
def create_grub(gtimeout=10):
12 years, 2 months
[multiboot-media-creator/python-development] changed readme
by Dave Riches
commit bbe20caebaa059f1f0eb1368e728330815a2c284
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 13 18:57:15 2011 +0000
changed readme
README | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/README b/README
index 8760056..833277a 100644
--- a/README
+++ b/README
@@ -8,7 +8,4 @@ It will take all of the .iso files within the working directory.
Usage:
-chmod +x multiboot-media-creator-0.1
-./multiboot-media-creator-0.1
-
-the result should be a Multi-Boot.iso image which can then be used, as described above
+he result should be a Multi-Boot.iso image which can then be used, as described above
12 years, 2 months
[multiboot-media-creator/python-development] converted to grub2, untested
by Dave Riches
commit 61187cbe4f014b4d07e484c5153a2b49fd619505
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 13 16:34:47 2011 +0000
converted to grub2, untested
multiboot-media-creator.py | 38 +++++++++++++++++++++-----------------
1 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 8535c31..2a92c8d 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -14,7 +14,7 @@
### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
### multiboot-media-creator Copyright 2010-2011 Robert 'Bob' Jensen <bob(a)fedoraunity.org>, Dave Riches <dcr226(a)fedorapeople.org>, Dennis Johnson <drjohnson1(a)gmail.com>, Ben Williams <vaioof(a)yahoo.com>
-import sys, os, glob, tempfile, shutil, parted
+import sys, os, glob, tempfile, shutil, parted, commands
__version__ = "$Revision: 4 $"
# $Source$
@@ -52,8 +52,8 @@ else:
mytemp=tempfile.mkdtemp(suffix=".mmc")
dev=options.device
-if dev==None:
- sys.exit("Program requires a destination device")
+#if dev==None:
+# sys.exit("Program requires a destination device")
print path
print dev
@@ -73,9 +73,14 @@ def umount_device(dev):
def grub_install():
try:
- os.system("grub-install --root-directory=%s %s" % (mytemp,dev))
+ os.system("grub2-install --root-directory=%s %s --force" % (mytemp,dev))
except:
sys.exit("Unable to grub-install, check device")
+ try:
+ os.system("e2label %s Multi-Boot" % dev)
+ except:
+ sys.exit("Unable to relabel device partition, boot will fail")
+
def getisos(isopath,isotype):
"""getisos returns a list of isos inside a specific path
based on a given type"""
@@ -123,7 +128,7 @@ def removetemps():
def make_iso():
shutil.copy2('/usr/share/grub/i386-redhat/stage2_eltorito', os.path.join(mytemp, "boot/grub/"))
- mkisocmd='mkisofs -R -v -V "Multi-Boot" -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -allow-limited-size -o Multi-Boot.iso %s' % mytemp
+ mkisocmd='mkisofs -R -J -v -V "MultiBoot" -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -allow-limited-size -o Multi-Boot.iso %s' % mytemp
os.system(mkisocmd)
def build_filesystem():
@@ -163,22 +168,21 @@ def build_filesystem():
print "Done!"
def create_grub(gtimeout=10):
- grub=open(os.path.join(mytemp, "boot/grub/grub.conf"), "w")
+ grub=open(os.path.join(mytemp, "boot/grub2/grub.cfg"), "w")
grub.write("splashimage=/boot/grub/splash.xpm.gz\ntimeout=%s\ndefault=0\n\n" % gtimeout)
for lives in getisos(path,"live"):
- BN=lives.strip(".iso")
- grub.write("title %s\n" % BN)
- grub.write(" kernel /%s/images/isolinux/vmlinuz0 root=live:LABEL=Multi-Boot live_dir=/%s/images/LiveOS/ rootfstype=auto ro liveimg quiet rhgb\n" % (BN,BN))
- grub.write(" initrd /%s/images/isolinux/initrd0.img\n\n" % BN)
+ BN=os.path.basename(lives.strip(".iso"))
+ grub.write("menuentry %s {\n" % BN)
+ grub.write(" linux /%s/images/isolinux/vmlinuz0 root=live:LABEL=Multi-Boot live_dir=/%s/images/LiveOS/ rootfstype=auto ro liveimg quiet rhgb\n" % (BN,BN))
+ grub.write(" initrd /%s/images/isolinux/initrd0.img\n}\n" % BN)
for dvds in getisos(path,"dvd"):
- BN=dvds.strip(".iso")
- grub.write("title %s\n" % BN)
- grub.write(" kernel /%s/boot/vmlinuz repo=hd:LABEL=Multi-Boot:/%s/\n" % (BN,BN))
- grub.write(" initrd /%s/boot/initrd.img\n\n" % BN)
- grub.write("title %s rescue\n" % BN)
+ BN=os.path.basename(dvds.strip(".iso"))
+ grub.write("menuentry %s {\n" % BN)
+ grub.write(" linux /%s/boot/vmlinuz repo=hd:LABEL=Multi-Boot:/%s/\n" % (BN,BN))
+ grub.write(" initrd /%s/boot/initrd.img\n}\n" % BN)
+ grub.write("title %s rescue {\n" % BN)
grub.write(" kernel /%s/boot/vmlinuz repo=hd:LABEL=Multi-Boot:/%s/ rescue\n" % (BN,BN))
- grub.write(" initrd /%s/boot/initrd.img\n\n" % BN)
-
+ grub.write(" initrd /%s/boot/initrd.img\n}\n" % BN)
grub.close()
#if __name__=="__main__":
12 years, 2 months
[multiboot-media-creator/python-development] added check_device() , checks to see if the device is already mounted/busy. if so, it exits
by Dave Riches
commit 891dfdff1e8ec0e3991a66ead62f2d8db1b9744e
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Tue Jan 11 14:12:28 2011 +0000
added check_device() , checks to see if the device is already mounted/busy. if so, it exits
multiboot-media-creator.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 5793212..8535c31 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -14,7 +14,7 @@
### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
### multiboot-media-creator Copyright 2010-2011 Robert 'Bob' Jensen <bob(a)fedoraunity.org>, Dave Riches <dcr226(a)fedorapeople.org>, Dennis Johnson <drjohnson1(a)gmail.com>, Ben Williams <vaioof(a)yahoo.com>
-import sys, os, glob, tempfile, shutil
+import sys, os, glob, tempfile, shutil, parted
__version__ = "$Revision: 4 $"
# $Source$
@@ -58,6 +58,13 @@ if dev==None:
print path
print dev
+def check_device():
+ devinfo=parted.getDevice(dev)
+ if devinfo.busy==True:
+ sys.exit("The device is busy or already mounted, please check and try again")
+ else:
+ print "Device not busy, continuing"
+
def mount_device(dev):
os.system("mount %s %s" % (dev, mytemp))
@@ -129,7 +136,7 @@ def build_filesystem():
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/"))
+ os.system("rsync -avH --progress %s %s" % (tree_path,os.path.join(mytemp, BN,"images/")))
umount_iso(i)
except:
print "No live isos found"
12 years, 2 months
[multiboot-media-creator/python-development] added exception handling to grub_install()
by Dave Riches
commit 00ff5b91d84820f359a6540322d80e6f5b472387
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Tue Jan 11 13:26:38 2011 +0000
added exception handling to grub_install()
multiboot-media-creator.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 836cc5d..5793212 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -65,8 +65,10 @@ def umount_device(dev):
os.system("umount %s" % dev)
def grub_install():
- os.system("grub-install --root-directory=%s %s" % (mytemp,dev))
-
+ try:
+ os.system("grub-install --root-directory=%s %s" % (mytemp,dev))
+ except:
+ sys.exit("Unable to grub-install, check device")
def getisos(isopath,isotype):
"""getisos returns a list of isos inside a specific path
based on a given type"""
12 years, 2 months
[multiboot-media-creator/python-development] added exception handling to mountiso() and makedirs()
by Dave Riches
commit daffb61537b281fb59603722420d98cde2cfc12b
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Tue Jan 11 13:23:17 2011 +0000
added exception handling to mountiso() and makedirs()
multiboot-media-creator.py | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 34ec61a..836cc5d 100755
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -87,16 +87,22 @@ based on a given type"""
def makedirs(iso,filesys):
BN=os.path.basename(iso.strip(".iso"))
- os.makedirs(os.path.join(mytemp, BN,"boot"))
- os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
- os.makedirs(os.path.join(mytemp, BN,"tmp"))
- if filesys=="dvd":
- os.makedirs(os.path.join(mytemp, BN,"images"))
+ try:
+ os.makedirs(os.path.join(mytemp, BN,"boot"))
+ os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
+ os.makedirs(os.path.join(mytemp, BN,"tmp"))
+ if filesys=="dvd":
+ os.makedirs(os.path.join(mytemp, BN,"images"))
+ except:
+ sys.exit("Unable to create directory structure on device")
print mytemp
def mount_iso(iso):
BN=os.path.basename(iso.strip(".iso"))
- os.system("mount -o loop %s %s" % (iso, os.path.join(mytemp, BN, "tmp")))
+ try:
+ os.system("mount -o loop %s %s" % (iso, os.path.join(mytemp, BN, "tmp")))
+ except:
+ sys.exit("Unable to mount device")
return os.path.join(mytemp, BN, "tmp")
def umount_iso(iso):
12 years, 2 months
[multiboot-media-creator/python-development] made rsync optional with -r or --rsync
by Dave Riches
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"
12 years, 2 months