3 # Copyright 2012 GRNET S.A. All rights reserved.
5 # Redistribution and use in source and binary forms, with or
6 # without modification, are permitted provided that the following
9 # 1. Redistributions of source code must retain the above
10 # copyright notice, this list of conditions and the following
13 # 2. Redistributions in binary form must reproduce the above
14 # copyright notice, this list of conditions and the following
15 # disclaimer in the documentation and/or other materials
16 # provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
31 # The views and conclusions contained in the software and
32 # documentation are those of the authors and should not be
33 # interpreted as representing official policies, either expressed
34 # or implied, of GRNET S.A.
44 from image_creator import __version__ as version
45 from image_creator.util import FatalError, MD5
46 from image_creator.output.dialog import GaugeOutput, InfoBoxOutput
47 from image_creator.disk import Disk
48 from image_creator.os_type import os_cls
49 from image_creator.kamaki_wrapper import Kamaki, ClientError
50 from image_creator.help import get_help_file
60 CONFIGURATION_TASKS = [
61 ("Partition table manipulation", ["FixPartitionTable"],
62 ["linux", "windows"]),
63 ("File system resize",
64 ["FilesystemResizeUnmounted", "FilesystemResizeMounted"],
65 ["linux", "windows"]),
66 ("Swap partition configuration", ["AddSwap"], ["linux"]),
67 ("SSH keys removal", ["DeleteSSHKeys"], ["linux"]),
68 ("Temporal RDP disabling", ["DisableRemoteDesktopConnections"],
70 ("SELinux relabeling at next boot", ["SELinuxAutorelabel"], ["linux"]),
71 ("Hostname/Computer Name assignment", ["AssignHostname"],
72 ["windows", "linux"]),
73 ("Password change", ["ChangePassword"], ["windows", "linux"]),
74 ("File injection", ["EnforcePersonality"], ["windows", "linux"])
78 class Reset(Exception):
82 class metadata_monitor(object):
83 def __init__(self, session, meta):
84 self.session = session
89 for (k, v) in self.meta.items():
92 def __exit__(self, type, value, traceback):
93 d = self.session['dialog']
98 for (k, v) in self.meta.items():
101 elif self.old[k] != v:
104 if not (len(added) or len(altered)):
107 msg = "The last action has changed some image properties:\n\n"
109 msg += "New image properties:\n"
110 for (k, v) in added.items():
111 msg += ' %s: "%s"\n' % (k, v)
114 msg += "Updated image properties:\n"
115 for (k, v) in altered.items():
116 msg += ' %s: "%s" -> "%s"\n' % (k, self.old[k], v)
119 self.session['metadata'].update(added)
120 self.session['metadata'].update(altered)
121 d.msgbox(msg, title="Image Property Changes", width=MSGBOX_WIDTH)
124 def extract_metadata_string(session):
125 metadata = ['%s=%s' % (k, v) for (k, v) in session['metadata'].items()]
127 if 'task_metadata' in session:
128 metadata.extend("%s=yes" % m for m in session['task_metadata'])
130 return '\n'.join(metadata) + '\n'
133 def confirm_exit(d, msg=''):
134 return not d.yesno("%s Do you want to exit?" % msg, width=YESNO_WIDTH)
137 def confirm_reset(d):
138 return not d.yesno("Are you sure you want to reset everything?",
139 width=YESNO_WIDTH, defaultno=1)
142 def update_background_title(session):
143 d = session['dialog']
144 dev = session['device']
148 size = (dev.meta['SIZE'] + MB - 1) // MB
149 shrinked = 'shrinked' in session and session['shrinked']
150 postfix = " (shrinked)" if shrinked else ''
152 title = "OS: %s, Distro: %s, Size: %dMB%s" % \
153 (dev.ostype, dev.distro, size, postfix)
155 d.setBackgroundTitle(title)
158 def extract_image(session):
159 d = session['dialog']
162 if dir and dir[-1] != os.sep:
165 (code, path) = d.fselect(dir, 10, 50, title="Save image as...")
166 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
169 if os.path.isdir(path):
173 if os.path.isdir("%s.meta" % path):
174 d.msgbox("Can't overwrite directory `%s.meta'" % path,
178 if os.path.isdir("%s.md5sum" % path):
179 d.msgbox("Can't overwrite directory `%s.md5sum'" % path,
183 basedir = os.path.dirname(path)
184 name = os.path.basename(path)
185 if not os.path.exists(basedir):
186 d.msgbox("Directory `%s' does not exist" % basedir,
194 files = ["%s%s" % (path, ext) for ext in ('', '.meta', '.md5sum')]
195 overwrite = filter(os.path.exists, files)
197 if len(overwrite) > 0:
198 if d.yesno("The following file(s) exist:\n"
199 "%s\nDo you want to overwrite them?" %
200 "\n".join(overwrite), width=YESNO_WIDTH):
203 out = GaugeOutput(d, "Image Extraction", "Extracting image...")
205 dev = session['device']
206 if "checksum" not in session:
207 size = dev.meta['SIZE']
209 session['checksum'] = md5.compute(session['snapshot'], size)
215 # Extract metadata file
216 out.output("Extracting metadata file...")
217 with open('%s.meta' % path, 'w') as f:
218 f.write(extract_metadata_string(session))
221 # Extract md5sum file
222 out.output("Extracting md5sum file...")
223 md5str = "%s %s\n" % (session['checksum'], name)
224 with open('%s.md5sum' % path, 'w') as f:
230 d.msgbox("Image file `%s' was successfully extracted!" % path,
237 def upload_image(session):
238 d = session["dialog"]
239 size = session['device'].meta['SIZE']
241 if "account" not in session:
242 d.msgbox("You need to provide your ~okeanos login username before you "
243 "can upload images to pithos+", width=MSGBOX_WIDTH)
246 if "token" not in session:
247 d.msgbox("You need to provide your ~okeanos account authentication "
248 "token before you can upload images to pithos+",
253 init = session["upload"] if "upload" in session else ''
254 (code, answer) = d.inputbox("Please provide a filename:", init=init,
255 width=INPUTBOX_WIDTH)
257 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
260 filename = answer.strip()
261 if len(filename) == 0:
262 d.msgbox("Filename cannot be empty", width=MSGBOX_WIDTH)
267 out = GaugeOutput(d, "Image Upload", "Uploading...")
269 if 'checksum' not in session:
271 session['checksum'] = md5.compute(session['snapshot'], size)
272 kamaki = Kamaki(session['account'], session['token'], out)
275 with open(session['snapshot'], 'rb') as f:
276 session["upload"] = kamaki.upload(f, size, filename,
277 "Calculating block hashes",
278 "Uploading missing blocks")
279 # Upload metadata file
280 out.output("Uploading metadata file...")
281 metastring = extract_metadata_string(session)
282 kamaki.upload(StringIO.StringIO(metastring), size=len(metastring),
283 remote_path="%s.meta" % filename)
287 out.output("Uploading md5sum file...")
288 md5str = "%s %s\n" % (session['checksum'], filename)
289 kamaki.upload(StringIO.StringIO(md5str), size=len(md5str),
290 remote_path="%s.md5sum" % filename)
293 except ClientError as e:
294 d.msgbox("Error in pithos+ client: %s" % e.message,
295 title="Pithos+ Client Error", width=MSGBOX_WIDTH)
296 if 'upload' in session:
297 del session['upload']
302 d.msgbox("Image file `%s' was successfully uploaded to pithos+" % filename,
308 def register_image(session):
309 d = session["dialog"]
311 if "account" not in session:
312 d.msgbox("You need to provide your ~okeanos login username before you "
313 "can register an images to cyclades",
317 if "token" not in session:
318 d.msgbox("You need to provide your ~okeanos account authentication "
319 "token before you can register an images to cyclades",
323 if "upload" not in session:
324 d.msgbox("You need to upload the image to pithos+ before you can "
325 "register it to cyclades", width=MSGBOX_WIDTH)
329 (code, answer) = d.inputbox("Please provide a registration name:",
330 width=INPUTBOX_WIDTH)
331 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
334 name = answer.strip()
336 d.msgbox("Registration name cannot be empty", width=MSGBOX_WIDTH)
341 metadata.update(session['metadata'])
342 if 'task_metadata' in session:
343 for key in session['task_metadata']:
344 metadata[key] = 'yes'
346 out = GaugeOutput(d, "Image Registration", "Registrating image...")
348 out.output("Registring image to cyclades...")
350 kamaki = Kamaki(session['account'], session['token'], out)
351 kamaki.register(name, session['upload'], metadata)
353 except ClientError as e:
354 d.msgbox("Error in pithos+ client: %s" % e.message)
359 d.msgbox("Image `%s' was successfully registered to cyclades as `%s'" %
360 (session['upload'], name), width=MSGBOX_WIDTH)
364 def kamaki_menu(session):
365 d = session['dialog']
366 default_item = "Account"
368 (session['account'], session['token']) = Kamaki.saved_credentials()
370 account = session["account"] if "account" in session else "<none>"
371 token = session["token"] if "token" in session else "<none>"
372 upload = session["upload"] if "upload" in session else "<none>"
374 choices = [("Account", "Change your ~okeanos username: %s" % account),
375 ("Token", "Change your ~okeanos token: %s" % token),
376 ("Upload", "Upload image to pithos+"),
377 ("Register", "Register the image to cyclades: %s" % upload)]
379 (code, choice) = d.menu(
380 text="Choose one of the following or press <Back> to go back.",
381 width=MENU_WIDTH, choices=choices, cancel="Back", height=13,
382 menu_height=5, default_item=default_item,
383 title="Image Registration Menu")
385 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
388 if choice == "Account":
389 default_item = "Account"
390 (code, answer) = d.inputbox(
391 "Please provide your ~okeanos account e-mail address:",
392 init=session["account"] if "account" in session else '',
394 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
396 if len(answer) == 0 and "account" in session:
397 del session["account"]
399 session["account"] = answer.strip()
400 Kamaki.save_account(session['account'])
401 default_item = "Token"
402 elif choice == "Token":
403 default_item = "Token"
404 (code, answer) = d.inputbox(
405 "Please provide your ~okeanos account authetication token:",
406 init=session["token"] if "token" in session else '',
408 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
410 if len(answer) == 0 and "token" in session:
413 session["token"] = answer.strip()
414 Kamaki.save_token(session['account'])
415 default_item = "Upload"
416 elif choice == "Upload":
417 if upload_image(session):
418 default_item = "Register"
420 default_item = "Upload"
421 elif choice == "Register":
422 if register_image(session):
425 default_item = "Register"
428 def add_property(session):
429 d = session['dialog']
432 (code, answer) = d.inputbox("Please provide a name for a new image"
433 " property:", width=INPUTBOX_WIDTH)
434 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
437 name = answer.strip()
439 d.msgbox("A property name cannot be empty", width=MSGBOX_WIDTH)
445 (code, answer) = d.inputbox("Please provide a value for image "
446 "property %s" % name, width=INPUTBOX_WIDTH)
447 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
450 value = answer.strip()
452 d.msgbox("Value cannot be empty", width=MSGBOX_WIDTH)
457 session['metadata'][name] = value
462 def modify_properties(session):
463 d = session['dialog']
467 for (key, val) in session['metadata'].items():
468 choices.append((str(key), str(val)))
470 (code, choice) = d.menu(
471 "In this menu you can edit existing image properties or add new "
472 "ones. Be careful! Most properties have special meaning and "
473 "alter the image deployment behaviour. Press <HELP> to see more "
474 "information about image properties. Press <BACK> when done.",
475 height=18, width=MENU_WIDTH, choices=choices, menu_height=10,
476 ok_label="Edit", extra_button=1, extra_label="Add", cancel="Back",
477 help_button=1, title="Image Properties")
479 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
482 elif code == d.DIALOG_OK:
483 (code, answer) = d.inputbox("Please provide a new value for the "
484 "image property with name `%s':" %
486 init=session['metadata'][choice],
487 width=INPUTBOX_WIDTH)
488 if code not in (d.DIALOG_CANCEL, d.DIALOG_ESC):
489 value = answer.strip()
491 d.msgbox("Value cannot be empty!")
494 session['metadata'][choice] = value
496 elif code == d.DIALOG_EXTRA:
497 add_property(session)
499 help_file = get_help_file("image_properties")
500 assert os.path.exists(help_file)
501 d.textbox(help_file, title="Image Properties", width=70, height=40)
504 def delete_properties(session):
505 d = session['dialog']
508 for (key, val) in session['metadata'].items():
509 choices.append((key, "%s" % val, 0))
511 (code, to_delete) = d.checklist("Choose which properties to delete:",
512 choices=choices, width=CHECKBOX_WIDTH)
514 # If the user exits with ESC or CANCEL, the returned tag list is empty.
516 del session['metadata'][i]
520 d.msgbox("%d image properties were deleted." % cnt, width=MSGBOX_WIDTH)
526 def exclude_tasks(session):
527 d = session['dialog']
533 if 'excluded_tasks' not in session:
534 session['excluded_tasks'] = []
536 if -1 in session['excluded_tasks']:
537 if not d.yesno("Image deployment configuration is disabled. "
538 "Do you wish to enable it?", width=YESNO_WIDTH):
539 session['excluded_tasks'].remove(-1)
543 for (msg, task, osfamily) in CONFIGURATION_TASKS:
544 if session['metadata']['OSFAMILY'] in osfamily:
545 checked = 1 if index in session['excluded_tasks'] else 0
546 choices.append((str(displayed_index), msg, checked))
547 mapping[displayed_index] = index
552 (code, tags) = d.checklist(
553 text="Please choose which configuration tasks you would like to "
554 "prevent from running during image deployment. "
555 "Press <No Config> to supress any configuration. "
556 "Press <Help> for more help on the image deployment "
557 "configuration tasks.",
558 choices=choices, height=19, list_height=8, width=CHECKBOX_WIDTH,
559 help_button=1, extra_button=1, extra_label="No Config",
560 title="Exclude Configuration Tasks")
562 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
564 elif code == d.DIALOG_HELP:
565 help_file = get_help_file("configuration_tasks")
566 assert os.path.exists(help_file)
567 d.textbox(help_file, title="Configuration Tasks",
570 elif code == d.DIALOG_EXTRA:
571 session['excluded_tasks'] = [-1]
572 session['task_metadata'] = ["EXCLUDE_ALL_TASKS"]
574 elif code == d.DIALOG_OK:
575 session['excluded_tasks'] = []
577 session['excluded_tasks'].append(mapping[int(tag)])
579 exclude_metadata = []
580 for task in session['excluded_tasks']:
581 exclude_metadata.extend(CONFIGURATION_TASKS[task][1])
583 session['task_metadata'] = map(lambda x: "EXCLUDE_TASK_%s" % x,
590 def sysprep(session):
591 d = session['dialog']
592 image_os = session['image_os']
594 # Is the image already shrinked?
595 if 'shrinked' in session and session['shrinked']:
596 msg = "It seems you have shrinked the image. Running system " \
597 "preparation tasks on a shrinked image is dangerous."
599 if d.yesno("%s\n\nDo you really want to continue?" % msg,
600 width=YESNO_WIDTH, defaultno=1):
603 wrapper = textwrap.TextWrapper(width=65)
605 help_title = "System Preperation Tasks"
606 sysprep_help = "%s\n%s\n\n" % (help_title, '=' * len(help_title))
608 if 'exec_syspreps' not in session:
609 session['exec_syspreps'] = []
611 all_syspreps = image_os.list_syspreps()
612 # Only give the user the choice between syspreps that have not ran yet
613 syspreps = [s for s in all_syspreps if s not in session['exec_syspreps']]
615 if len(syspreps) == 0:
616 d.msgbox("No system preparation task available to run!",
617 title="System Preperation", width=MSGBOX_WIDTH)
623 for sysprep in syspreps:
624 name, descr = image_os.sysprep_info(sysprep)
625 display_name = name.replace('-', ' ').capitalize()
626 sysprep_help += "%s\n" % display_name
627 sysprep_help += "%s\n" % ('-' * len(display_name))
628 sysprep_help += "%s\n\n" % wrapper.fill(" ".join(descr.split()))
629 enabled = 1 if sysprep.enabled else 0
630 choices.append((str(index + 1), display_name, enabled))
633 (code, tags) = d.checklist(
634 "Please choose which system preperation tasks you would like to "
635 "run on the image. Press <Help> to see details about the system "
636 "preperation tasks.", title="Run system preperation tasks",
637 choices=choices, width=70, ok_label="Run", help_button=1)
639 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
641 elif code == d.DIALOG_HELP:
642 d.scrollbox(sysprep_help, width=HELP_WIDTH)
643 elif code == d.DIALOG_OK:
644 # Enable selected syspreps and disable the rest
645 for i in range(len(syspreps)):
646 if str(i + 1) in tags:
647 image_os.enable_sysprep(syspreps[i])
648 session['exec_syspreps'].append(syspreps[i])
650 image_os.disable_sysprep(syspreps[i])
652 out = InfoBoxOutput(d, "Image Configuration")
654 dev = session['device']
656 dev.mount(readonly=False)
658 # The checksum is invalid. We have mounted the image rw
659 if 'checksum' in session:
660 del session['checksum']
662 # Monitor the metadata changes during syspreps
663 with metadata_monitor(session, image_os.meta):
665 image_os.do_sysprep()
666 image_os.out.finalize()
668 # Disable syspreps that have ran
669 for sysprep in session['exec_syspreps']:
670 image_os.disable_sysprep(sysprep)
681 d = session['dialog']
682 dev = session['device']
684 shrinked = 'shrinked' in session and session['shrinked']
687 d.msgbox("The image is already shrinked!", title="Image Shrinking",
691 msg = "This operation will shrink the last partition of the image to " \
692 "reduce the total image size. If the last partition is a swap " \
693 "partition, then this partition is removed and the partition " \
694 "before that is shrinked. The removed swap partition will be " \
695 "recreated during image deployment."
697 if not d.yesno("%s\n\nDo you want to continue?" % msg, width=70,
698 height=12, title="Image Shrinking"):
699 with metadata_monitor(session, dev.meta):
700 dev.out = InfoBoxOutput(d, "Image Shrinking", height=4)
704 session['shrinked'] = True
705 update_background_title(session)
712 def customization_menu(session):
713 d = session['dialog']
715 choices = [("Sysprep", "Run various image preperation tasks"),
716 ("Shrink", "Shrink image"),
717 ("View/Modify", "View/Modify image properties"),
718 ("Delete", "Delete image properties"),
719 ("Exclude", "Exclude various deployment tasks from running")]
723 actions = {"Sysprep": sysprep,
725 "View/Modify": modify_properties,
726 "Delete": delete_properties,
727 "Exclude": exclude_tasks}
729 (code, choice) = d.menu(
730 text="Choose one of the following or press <Back> to exit.",
731 width=MENU_WIDTH, choices=choices, cancel="Back", height=13,
732 menu_height=len(choices), default_item=choices[default_item][0],
733 title="Image Customization Menu")
735 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
737 elif choice in actions:
738 default_item = [entry[0] for entry in choices].index(choice)
739 if actions[choice](session):
740 default_item = (default_item + 1) % len(choices)
743 def main_menu(session):
744 d = session['dialog']
745 dev = session['device']
747 update_background_title(session)
749 choices = [("Customize", "Customize image & ~okeanos deployment options"),
750 ("Register", "Register image to ~okeanos"),
751 ("Extract", "Dump image to local file system"),
752 ("Reset", "Reset everything and start over again"),
753 ("Help", "Get help for using snf-image-creator")]
755 default_item = "Customize"
757 actions = {"Customize": customization_menu, "Register": kamaki_menu,
758 "Extract": extract_image}
760 (code, choice) = d.menu(
761 text="Choose one of the following or press <Exit> to exit.",
762 width=MENU_WIDTH, choices=choices, cancel="Exit", height=13,
763 default_item=default_item, menu_height=len(choices),
764 title="Image Creator for ~okeanos (snf-image-creator version %s)" %
767 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
770 elif choice == "Reset":
772 d.infobox("Resetting snf-image-creator. Please wait...",
775 elif choice in actions:
776 actions[choice](session)
779 def select_file(d, media):
782 if media is not None:
783 if not os.path.exists(media):
784 d.msgbox("The file you choose does not exist",
789 (code, media) = d.fselect(root, 10, 50,
790 title="Please select input media")
791 if code in (d.DIALOG_CANCEL, d.DIALOG_ESC):
792 if confirm_exit(d, "You canceled the media selection dialog box."):
805 def image_creator(d):
807 usage = "Usage: %prog [options] [<input_media>]"
808 parser = optparse.OptionParser(version=version, usage=usage)
810 options, args = parser.parse_args(sys.argv[1:])
813 parser.error("Wrong numver of arguments")
815 d.setBackgroundTitle('snf-image-creator')
817 if os.geteuid() != 0:
818 raise FatalError("You must run %s as root" % basename)
820 media = select_file(d, args[0] if len(args) == 1 else None)
822 out = GaugeOutput(d, "Initialization", "Initializing...")
823 disk = Disk(media, out)
825 def signal_handler(signum, frame):
829 signal.signal(signal.SIGINT, signal_handler)
831 snapshot = disk.snapshot()
832 dev = disk.get_device(snapshot)
835 for (key, value) in dev.meta.items():
836 metadata[str(key)] = str(value)
838 dev.mount(readonly=True)
839 out.output("Collecting image metadata...")
840 cls = os_cls(dev.distro, dev.ostype)
841 image_os = cls(dev.root, dev.g, out)
844 for (key, value) in image_os.meta.items():
845 metadata[str(key)] = str(value)
850 # Make sure the signal handler does not call out.cleanup again
853 out.cleanup = type(GaugeOutput.cleanup)(dummy, out, GaugeOutput)
855 session = {"dialog": d,
857 "snapshot": snapshot,
859 "image_os": image_os,
860 "metadata": metadata}
862 msg = "snf-image-creator detected a %s system on the input media. " \
863 "Would you like to run a wizards to assists you through the " \
864 "image creation process?\n\nChoose <Yes> to run the wizard, " \
865 "<No> to run the snf-image-creator in expert mode or press " \
866 "ESC to quit the program." \
867 % (dev.ostype if dev.ostype == dev.distro else "%s/%s" %
868 (dev.distro, dev.ostype))
871 code = d.yesno(msg, width=YESNO_WIDTH, height=12)
872 if code == d.DIALOG_OK:
875 elif code == d.DIALOG_CANCEL:
879 exit_msg = "You have not selected if you want to run " \
880 "snf-image-creator in wizard or expert mode."
881 if confirm_exit(d, exit_msg):
884 d.infobox("Thank you for using snf-image-creator. Bye", width=53)
893 d = dialog.Dialog(dialog="dialog")
895 # Add extra button in dialog library
896 dialog._common_args_syntax["extra_button"] = \
897 lambda enable: dialog._simple_option("--extra-button", enable)
899 dialog._common_args_syntax["extra_label"] = \
900 lambda string: ("--extra-label", string)
905 ret = image_creator(d)
907 except FatalError as e:
908 msg = textwrap.fill(str(e), width=70)
909 d.infobox(msg, width=INFOBOX_WIDTH, title="Fatal Error")
914 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :