kadischi/livecd_generator kadischi.py,1.39,1.40
Jasper O'neal Hartline (autopsy)
fedora-extras-commits at redhat.com
Sat Aug 19 13:54:01 UTC 2006
Author: autopsy
Update of /cvs/devel/kadischi/livecd_generator
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9929/kadischi/livecd_generator
Modified Files:
kadischi.py
Log Message:
Provide simple BURN and VERIFY dialog for users, (#RFE# Robert Jensen)
Index: kadischi.py
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/kadischi.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- kadischi.py 17 Aug 2006 15:43:50 -0000 1.39
+++ kadischi.py 19 Aug 2006 13:53:59 -0000 1.40
@@ -1,8 +1,8 @@
#!/usr/bin/python -tt
-import os, rpm, sys
+import os, rpm, sys
import optparse
-import string
+import string, re
import shutil
from shvar import shvarFile
from functions import *
@@ -30,7 +30,7 @@
bindir = sys.path [0]
confdir = normalize_path(['/etc/kadischi'])
- global builddir, postscriptdir, buildstamp
+ global builddir, postscriptdir, buildstamp, isoimage
# check for Requires
print "[kadischi]: Checking dependencies for Kadischi"
@@ -202,10 +202,46 @@
cleanup (builddir)
# Done!
- print "[kadischi]: Finished successfully."
- return 0
+ # print "[kadischi]: Finished successfully."
+ # return 0
+ ### Burn the CD
+ using_kickstart = False
+ using_cmdline = False
+ for args in anaconda_args:
+ if re.search("--kickstart=", args) != None:
+ using_kickstart = True
+ if re.search("--cmdline", args) != None:
+ using_cmdline = True
+ if using_kickstart == True or using_cmdline == True:
+ print "[kadischi]: Finished successfully"
+ return 0
+
+ choice = ""
+ device = ""
+ print "[kadischi]: Kadischi is finished building the Live ISO image.."
+ choice = raw_input("[kadischi]: Would you like to burn the CD image now? [yes/no]: ")
+ if choice == "yes":
+ device = raw_input("[kadischi]: What device is your CDROM or DVDROM? [/dev/hda]: ")
+ if device == None:
+ device = "dev=/dev/hda"
+ else:
+ device = string.join(["dev=", device], "")
+ burn_cd(device)
+ burned = True
+ else:
+ print "[kadischi]: Finished successfully."
+ return 0
+ ### Verify the CD
+ choice = raw_input("[kadischi]: Would you like to verify the CD or DVD burned? [yes/no]: ")
+ if choice == "yes":
+ dev = device[4:]
+ device = string.join(["if=", dev], "")
+ verify_cd(device)
+ else:
+ print "[kadischi]: Finished successfully."
+ return 0
def requirements():
""" Searches which Requires has not yet installed """
@@ -347,6 +383,41 @@
clear_rpm_db_files(sysdir)
+def burn_cd(device):
+ args = ["/usr/bin/cdrecord", "speed=4", device, isoimage]
+ try:
+ execute(args)
+ except:
+ print "[kadischi]: cdrecord not found or other error! Bailing!"
+ sys.exit(1)
+
+ print >> sys.stdout, "[kadischi]: CD has been burned!"
+
+def verify_cd(device):
+ os.system(("/bin/dd %s of=/tmp/kadischi-live.iso bs=2048") % device)
+ os.system("/usr/bin/sha1sum /tmp/kadischi-live.iso > /tmp/kadischi-live.iso.disc.sha1sum")
+ os.system(("/usr/bin/sha1sum %s > /tmp/kadischi-live.iso.original.sha1sum") % isoimage)
+
+ e = open("/tmp/kadischi-live.iso.disc.sha1sum", "r")
+ f = open("/tmp/kadischi-live.iso.original.sha1sum", "r")
+ copy = e.readline()
+ original = f.readline()
+
+ string.split(copy, " ")
+ string.split(original, " ")
+
+ if original[0] == copy[0]:
+ print >> sys.stdout, "[kadischi]: CD or DVD has been burned and verified! Done!"
+ args = ["/bin/rm", "-f", "/tmp/kadischi-live.iso"]
+ execute(args)
+ return 0
+ else:
+ print "[kadischi]: SHA1SUM DO NOT MATCH. CD OR DVD IS BAD!"
+ args = ["/bin/rm", "-f", "/tmp/kadischi-live.iso"]
+ execute(args)
+ return 0
+
+
def execute (args):
if not os.access(args[0], os.X_OK):
print "unable to access", args[0]
More information about the fedora-extras-commits
mailing list