[multiboot-media-creator/python-development] added cli options for directory and usb device
by Dave Riches
commit 9ba8a0ecc75a00a2cb3a9939ba62bb5077f880e1
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Mon Jan 10 21:07:22 2011 +0000
added cli options for directory and usb device
multiboot-media-creator.py | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 1ad0a4f..979576f 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -21,13 +21,38 @@ __version__ = "$Revision: 4 $"
VERSION = '0.4.0'
-variables = {}
+from optparse import OptionParser
-enable = ('yes', 'on', 'true', '1')
-disable = ('no', 'off', 'false', '0')
+parser = OptionParser()
+parser.add_option("-d", "--directory", dest="directory",
+ help="Directory containing ISO images", metavar="DIR")
+parser.add_option("-q", "--quiet",
+ action="store_false", dest="verbose", default=True,
+ help="don't print status messages to stdout (curently not implemented)")
+parser.add_option("-D", "--device", dest="device",
+ help="USB device to create media", metavar="USB")
+(options, args) = parser.parse_args()
+
+#print options.directory
+
+#variables = {}
+
+#enable = ('yes', 'on', 'true', '1')
+#disable = ('no', 'off', 'false', '0')
+
+if options.directory==None:
+ path=os.getcwd()
+else:
+ path=options.directory
-path=os.getcwd() # ok, so this will need to change
mytemp=tempfile.mkdtemp(suffix=".mmc")
+dev=options.device
+print path
+print dev
+
+def mount_device(device):
+ os.system("mount %s %s" % (dev, mytemp))
+
def getisos(isopath,isotype):
"""getisos returns a list of isos inside a specific path
13 years, 3 months
[multiboot-media-creator/python-development] added gtimeout argument to create_grub(). Its optional, default is 10
by Dave Riches
commit c628fa2d676181b5da62298ebce6d48596fb02cc
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Sun Jan 9 16:37:49 2011 +0000
added gtimeout argument to create_grub(). Its optional, default is 10
multiboot-media-creator.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 2e3eaf1..1ad0a4f 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -100,9 +100,9 @@ def build_filesystem():
os.makedirs(os.path.join(mytemp, "boot/grub"))
print "Done!"
-def create_grub():
+def create_grub(gtimeout=10):
grub=open(os.path.join(mytemp, "boot/grub/grub.conf"), "w")
- grub.write("splashimage=/boot/grub/splash.xpm.gz\ntimeout=10\ndefault=0\n\n")
+ 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)
@@ -119,8 +119,8 @@ def create_grub():
grub.close()
-if __name__=="__main__":
- build_filesystem()
- create_grub()
- make_iso()
- removetemps()
+#if __name__=="__main__":
+# build_filesystem()
+# create_grub()
+# make_iso()
+# removetemps()
13 years, 4 months
[multiboot-media-creator/python-development] added rescue options for dvd media
by Dave Riches
commit 0b073d754f1fd571be3a7b6837093e472162fc8d
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Sun Jan 9 16:32:26 2011 +0000
added rescue options for dvd media
multiboot-media-creator.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 4aa8cab..2e3eaf1 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -113,6 +113,10 @@ def create_grub():
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)
+ 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.close()
if __name__=="__main__":
13 years, 4 months
[multiboot-media-creator/python-development] builds filesystem for both lives and dvds, creates iso. This time i've added if __name__==__main__ s
by Dave Riches
commit d66e1236d7017bed5607e197c739e9bc8a56bc7f
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Fri Jan 7 19:03:16 2011 +0000
builds filesystem for both lives and dvds, creates iso. This time i've added if __name__==__main__ so it functions the same as the bash script. needs testing, I'm tired
multiboot-media-creator.py | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 2285a28..4aa8cab 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -47,12 +47,13 @@ based on a given type"""
isos.append(os.path.basename(i))
return isos
-def makedirs(iso):
+def makedirs(iso,filesys):
BN=iso.strip(".iso")
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"))
+ if filesys=="dvd":
+ os.makedirs(os.path.join(mytemp, BN,"images"))
print mytemp
def mount_iso(iso):
@@ -68,7 +69,6 @@ def removetemps():
shutil.rmtree(mytemp)
def make_iso():
- os.makedirs(os.path.join(mytemp, "boot/grub"))
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
os.system(mkisocmd)
@@ -78,7 +78,7 @@ def build_filesystem():
for i in getisos(path, "live"):
print "Building filesystem for: %s" % i
BN=i.strip(".iso")
- makedirs(i)
+ makedirs(i, "live")
tree_path=mount_iso(i)
shutil.copytree(tree_path,os.path.join(mytemp, BN,"images/"))
umount_iso(i)
@@ -87,12 +87,36 @@ def build_filesystem():
try:
for i in getisos(path, "dvd"):
print "Building filesystem for: %s" % i
- BN=i.strip(".iso")
- makedirs(i)
+ 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/"))
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(os.path.join(path, i),os.path.join(mytemp, BN))
umount_iso(i)
except:
print "No dvd isos found"
+ os.makedirs(os.path.join(mytemp, "boot/grub"))
print "Done!"
+
+def create_grub():
+ grub=open(os.path.join(mytemp, "boot/grub/grub.conf"), "w")
+ grub.write("splashimage=/boot/grub/splash.xpm.gz\ntimeout=10\ndefault=0\n\n")
+ 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)
+ 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.close()
+
+if __name__=="__main__":
+ build_filesystem()
+ create_grub()
+ make_iso()
+ removetemps()
13 years, 4 months
[multiboot-media-creator/python-development] remove mount_and_steal, not needed anymore
by Dave Riches
commit daa83998194389946d94d6ebd8afe3048cea85eb
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Fri Jan 7 13:58:17 2011 +0000
remove mount_and_steal, not needed anymore
multiboot-media-creator.py | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 7ab78b1..2285a28 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -73,21 +73,6 @@ def make_iso():
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
os.system(mkisocmd)
-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=os.path.basename(i)
- 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
- make_iso()
-
def build_filesystem():
try:
for i in getisos(path, "live"):
13 years, 4 months
[multiboot-media-creator/python-development] refactoring and added build_filesystem()
by Dave Riches
commit b6aae469b22647950b69c6c111acfb6029518073
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Fri Jan 7 13:05:38 2011 +0000
refactoring and added build_filesystem()
multiboot-media-creator.py | 42 +++++++++++++++++++++++++++++++++++-------
1 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 6a7f18b..7ab78b1 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -30,32 +30,38 @@ path=os.getcwd() # ok, so this will need to change
mytemp=tempfile.mkdtemp(suffix=".mmc")
def getisos(isopath,isotype):
+ """getisos returns a list of isos inside a specific path
+based on a given type"""
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:
- print i,info
+ isos.append(os.path.basename(i))
+ return isos
def makedirs(iso):
- BN=iso.strip(".iso"+path)
+ BN=iso.strip(".iso")
os.makedirs(os.path.join(mytemp, BN,"boot"))
- os.makedirs(os.path.join(mytemp, BN,"images"))
+# 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)
+ BN=iso.strip(".iso")
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)
+ BN=iso.strip(".iso")
os.system("umount %s" % (iso))
def removetemps():
@@ -72,7 +78,7 @@ def mount_and_steal():
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)
+ BN=os.path.basename(i)
mount_path=mount_iso(i)
print "Mounted iso: %s" % i
print "Mount point is: %s" % mount_path
@@ -82,4 +88,26 @@ then mount the isos, then steal the kernels, then un-mount the isos. You get the
print "Un-mounted iso: %s" % i
make_iso()
-
+def build_filesystem():
+ try:
+ for i in getisos(path, "live"):
+ print "Building filesystem for: %s" % i
+ BN=i.strip(".iso")
+ makedirs(i)
+ tree_path=mount_iso(i)
+ shutil.copytree(tree_path,os.path.join(mytemp, BN,"images/"))
+ umount_iso(i)
+ except:
+ print "No live isos found"
+ try:
+ for i in getisos(path, "dvd"):
+ print "Building filesystem for: %s" % i
+ BN=i.strip(".iso")
+ makedirs(i)
+ tree_path=mount_iso(i)
+ 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/"))
+ umount_iso(i)
+ except:
+ print "No dvd isos found"
+ print "Done!"
13 years, 4 months
[multiboot-media-creator/python-development] getisos() now has the ability to determine the type of iso. it is called like getisos(path, type). ex
by Dave Riches
commit d543540c8e64a8b91814c0f3f976da86bfb52bf9
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Fri Jan 7 09:41:04 2011 +0000
getisos() now has the ability to determine the type of iso. it is called like getisos(path,type). example getisos(./,live) would return a list of the live iso's in the cwd
multiboot-media-creator.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index be0db4f..6a7f18b 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -29,9 +29,17 @@ disable = ('no', 'off', 'false', '0')
path=os.getcwd() # ok, so this will need to change
mytemp=tempfile.mkdtemp(suffix=".mmc")
-def getisos(isopath):
+def getisos(isopath,isotype):
isopath=os.path.join(isopath, "*.iso")
- return glob.glob(isopath)
+ 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"
+ else:
+ info="live"
+ os.system("umount %s &>/dev/null" % i)
+ if info==isotype:
+ print i,info
def makedirs(iso):
BN=iso.strip(".iso"+path)
13 years, 4 months
[multiboot-media-creator/python-development] added iso-creating function, and appended it to mount_and_steal
by Dave Riches
commit c48fe6745c563cd8e1184b2dcefa811adfe90719
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 6 15:17:42 2011 +0000
added iso-creating function, and appended it to mount_and_steal
multiboot-media-creator.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index 6b55748..be0db4f 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -53,6 +53,12 @@ def umount_iso(iso):
def removetemps():
shutil.rmtree(mytemp)
+def make_iso():
+ os.makedirs(os.path.join(mytemp, "boot/grub"))
+ 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
+ os.system(mkisocmd)
+
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"""
@@ -66,3 +72,6 @@ then mount the isos, then steal the kernels, then un-mount the isos. You get the
print "Stole the kernel"
umount_iso(i)
print "Un-mounted iso: %s" % i
+ make_iso()
+
+
13 years, 4 months
[multiboot-media-creator/python-development] refactored the functions, added test function, removed default functionality because its not needed
by Dave Riches
commit d8f1b60f7bfb966bd495b2bdbad8c8a0a0a16b6a
Author: Dave Riches <dcr226(a)fedorapeople.org>
Date: Thu Jan 6 13:32:34 2011 +0000
refactored the functions, added test function, removed default functionality because its not needed at this stage
multiboot-media-creator.py | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/multiboot-media-creator.py b/multiboot-media-creator.py
index c1c494e..6b55748 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -26,12 +26,6 @@ variables = {}
enable = ('yes', 'on', 'true', '1')
disable = ('no', 'off', 'false', '0')
-def lives():
- """This part handles live images"""
-
-def installs():
- """This part handles installation images"""
-
path=os.getcwd() # ok, so this will need to change
mytemp=tempfile.mkdtemp(suffix=".mmc")
@@ -39,18 +33,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)
@@ -59,5 +53,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
13 years, 4 months
[multiboot-media-creator/python-development] Fixed email addresses
by Robert 'Bob' Jensen
commit 79a78da95b94555cf89f041eafb63eb1b76b6078
Author: Robert 'Bob' Jensen <bob(a)fedoraunity.org>
Date: Wed Jan 5 15:23:22 2011 -0600
Fixed email addresses
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 5359ae5..c1c494e 100644
--- a/multiboot-media-creator.py
+++ b/multiboot-media-creator.py
@@ -12,7 +12,7 @@
### You should have received a copy of the GNU Library General Public License
### along with this program; if not, write to the Free Software
### 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 <email>, Ben Williams <email>
+### 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 os, glob, tempfile, shutil
13 years, 4 months