commit b3e8fbba51eab5a546519831d0d16639fb8d80ab
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Wed Jan 5 20:45:16 2011 +0000
refactored mount/umount and makedirs(). Added mount_and_steal test function
multiboot-media-creator.py | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index b9bdf68..a5b0a5b 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -17,18 +17,18 @@ def getisos(isopath):
isopath=os.path.join(isopath, "*.iso")
return glob.glob(isopath)
-def makedirs():
- for i in getisos(path):
- BN=i.strip(".iso"+path)
- os.makedirs(os.path.join(mytemp, BN,"boot"))
- os.makedirs(os.path.join(mytemp, BN,"images"))
- os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
- os.makedirs(os.path.join(mytemp, BN,"tmp"))
+def makedirs(iso):
+ BN=iso.strip(".iso"+path)
+ os.makedirs(os.path.join(mytemp, BN,"boot"))
+ os.makedirs(os.path.join(mytemp, BN,"images"))
+ os.makedirs(os.path.join(mytemp, BN,"CHECKSUM"))
+ os.makedirs(os.path.join(mytemp, BN,"tmp"))
print mytemp
def mount_iso(iso):
BN=iso.strip(".iso"+path)
os.system("mount -o loop %s %s" % (iso, os.path.join(mytemp, BN,
"tmp")))
+ return os.path.join(mytemp, BN, "tmp")
def umount_iso(iso):
BN=iso.strip(".iso"+path)
@@ -37,5 +37,16 @@ def umount_iso(iso):
def removetemps():
shutil.rmtree(mytemp)
-if __name__ == "__main__":
- makedirs()
+def mount_and_steal():
+ """Realistically, this is only here to prove things are working. It
will create the temps
+then mount the isos, then steal the kernels, then un-mount the isos. You get the
idea"""
+ for i in getisos(path):
+ makedirs(i)
+ BN=i.strip(".iso"+path)
+ mount_path=mount_iso(i)
+ print "Mounted iso: %s" % i
+ print "Mount point is: %s" % mount_path
+ shutil.copy2(mount_path+"/isolinux/vmlinuz0",os.path.join(mytemp,
BN,"images/"))
+ print "Stole the kernel"
+ umount_iso(i)
+ print "Un-mounted iso: %s" % i
Show replies by date