def check_uid_root():
"""Check for root permissions"""
if not os.geteuid() == 0:
- sys.exit("Error: please run this script with uid 0 (root).")
+ raise CriticalException("please run this script with uid 0 (root).")
def check_boot_flag(device):
if not os.path.isfile(mbrtemplate):
logging.error('Error installing MBR (either try --syslinux-mbr or '
'install missing file "%s"?)', mbrtemplate)
- raise CriticalException("Error: %s can not be read.", mbrtemplate)
+ raise CriticalException("%s can not be read." % mbrtemplate)
if partition is not None and ((partition < 0) or (partition > 3)):
logging.warn("Cannot activate partition %d", partition)
squashfs = search_file(grml_flavour + '.squashfs', iso_mount)
if squashfs is None:
logging.error("error locating squashfs file")
- raise CriticalException("Fatal: squashfs file not found"
+ raise CriticalException("squashfs file not found"
", please check that your iso is not corrupt")
else:
squashfs_target = target + '/live/' + grml_flavour + '/'
if not source_dir:
raise CriticalException(
- "Fatal: file default.cfg could not be found." \
- "Note: this grml2usb version requires an ISO generated by grml-live >=0.9.24 ..." \
+ "file default.cfg could not be found.\n"
+ "Note: this grml2usb version requires an ISO generated by grml-live >=0.9.24 ...\n"
" ... either use grml releases >=2009.10 or switch to an older grml2usb version.")
if not os.path.exists(iso_mount + '/boot/grub/footer.cfg'):
try:
remove_mountpoint(iso_mountpoint)
except CriticalException, error:
- logging.critical("Fatal: %s", error)
cleanup()
+ raise
def install_grml(mountpoint, device):
check_boot_flag(device)
mount(device, device_mountpoint, ['-o', 'utf8,iocharset=iso8859-1'])
except VerifyException, error:
- logging.critical("Fatal: %s", error)
raise
except CriticalException, error:
mount(device, device_mountpoint, "")
os.rmdir(mountpoint)
unregister_tmpfile(mountpoint)
except CriticalException, error:
- logging.critical("Fatal: %s", error)
cleanup()
+ raise
def handle_mbr(device):
@opts option dict from OptionParser
"""
if opts.grubmbr and not opts.grub:
- logging.critical("Error: --grub-mbr requires --grub option.")
- sys.exit(1)
+ raise CriticalException("--grub-mbr requires --grub option.")
def check_programs():