Revision 5a0399d8 image_creator/dialog_main.py
b/image_creator/dialog_main.py | ||
---|---|---|
39 | 39 |
import textwrap |
40 | 40 |
import signal |
41 | 41 |
import StringIO |
42 |
import optparse |
|
42 | 43 |
|
43 | 44 |
from image_creator import __version__ as version |
44 | 45 |
from image_creator.util import FatalError, MD5 |
... | ... | |
608 | 609 |
syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']] |
609 | 610 |
|
610 | 611 |
if len(syspreps) == 0: |
611 |
d.msgbox("No system preparation task available to run!", title="System Preperation", width=MSGBOX_WIDTH) |
|
612 |
d.msgbox("No system preparation task available to run!", |
|
613 |
title="System Preperation", width=MSGBOX_WIDTH) |
|
612 | 614 |
return |
613 | 615 |
|
614 | 616 |
while 1: |
... | ... | |
792 | 794 |
return media |
793 | 795 |
|
794 | 796 |
|
797 |
def wizard(session): |
|
798 |
pass |
|
799 |
|
|
800 |
|
|
795 | 801 |
def image_creator(d): |
796 |
basename = os.path.basename(sys.argv[0]) |
|
797 |
usage = "Usage: %s [input_media]" % basename |
|
798 |
if len(sys.argv) > 2: |
|
799 |
sys.stderr.write("%s\n" % usage) |
|
800 |
return 1 |
|
802 |
|
|
803 |
usage = "Usage: %prog [options] [<input_media>]" |
|
804 |
parser = optparse.OptionParser(version=version, usage=usage) |
|
805 |
|
|
806 |
options, args = parser.parse_args(sys.argv[1:]) |
|
807 |
|
|
808 |
if len(args) > 1: |
|
809 |
parser.error("Wrong numver of arguments") |
|
801 | 810 |
|
802 | 811 |
d.setBackgroundTitle('snf-image-creator') |
803 | 812 |
|
804 | 813 |
if os.geteuid() != 0: |
805 | 814 |
raise FatalError("You must run %s as root" % basename) |
806 | 815 |
|
807 |
media = select_file(d, sys.argv[1] if len(sys.argv) == 2 else None)
|
|
816 |
media = select_file(d, args[0] if len(args) == 1 else None)
|
|
808 | 817 |
|
809 | 818 |
out = GaugeOutput(d, "Initialization", "Initializing...") |
810 | 819 |
disk = Disk(media, out) |
... | ... | |
846 | 855 |
"image_os": image_os, |
847 | 856 |
"metadata": metadata} |
848 | 857 |
|
849 |
main_menu(session) |
|
858 |
msg = "Would you like to run the snf-image-creator wizard? " \ |
|
859 |
"Choose <Yes> if you want to run a wizards to assists " \ |
|
860 |
"you through the image creation process. Choose <No> to run " \ |
|
861 |
"the program in expert mode." |
|
862 |
|
|
863 |
if d.yesno(msg, width=YESNO_WIDTH): |
|
864 |
main_menu(session) |
|
865 |
else: |
|
866 |
wizard(session) |
|
867 |
|
|
850 | 868 |
d.infobox("Thank you for using snf-image-creator. Bye", width=53) |
851 | 869 |
finally: |
852 | 870 |
disk.cleanup() |
Also available in: Unified diff