from optparse import OptionParser
from inspect import isroutine, isclass
import datetime
from optparse import OptionParser
from inspect import isroutine, isclass
import datetime
grub or syslinux and root access.\n\
\n\
Run %prog --help for usage hints, further information via: man grml2usb"
grub or syslinux and root access.\n\
\n\
Run %prog --help for usage hints, further information via: man grml2usb"
logging.debug('RuntimeError while umount %s, ignoring' % device)
for tmppath in TMPFILES.copy():
logging.debug('RuntimeError while umount %s, ignoring' % device)
for tmppath in TMPFILES.copy():
msg = 'RuntimeError while removing temporary %s, ignoring'
logging.debug(msg % tmppath)
msg = 'RuntimeError while removing temporary %s, ignoring'
logging.debug(msg % tmppath)
-def search_file(filename, search_path='/bin' + os.pathsep + '/usr/bin', lst_return=False):
+def search_file(filename, search_path='/bin' + os.pathsep + '/usr/bin', lst_return=False, required=False):
"""Given a search path, find file
@filename: name of file to search for
"""Given a search path, find file
@filename: name of file to search for
# update the existing flavours on the target
for line in fileinput.input([target_grml_version_file], inplace=1):
flavour = get_flavour(line)
# update the existing flavours on the target
for line in fileinput.input([target_grml_version_file], inplace=1):
flavour = get_flavour(line)
grub_target = target + '/boot/grub/'
execute(mkdir, grub_target)
grub_target = target + '/boot/grub/'
execute(mkdir, grub_target)
exec_rsync(logo, syslinux_target + 'logo.16')
bootx64_efi = search_file('bootx64.efi', iso_mount)
exec_rsync(logo, syslinux_target + 'logo.16')
bootx64_efi = search_file('bootx64.efi', iso_mount)
logging.critical("Error: could not find grml-version file.")
logging.critical("Looks like your system is running from RAM but required files are not available.")
logging.critical("Please either boot without toram=... or use boot option toram instead of toram=...")
logging.critical("Error: could not find grml-version file.")
logging.critical("Looks like your system is running from RAM but required files are not available.")
logging.critical("Please either boot without toram=... or use boot option toram instead of toram=...")
if shortname in filename:
line = live_media_path_re.sub('', line)
line = line.rstrip() + ' live-media-path=/live/%s/ ' % (grml_flavour)
if shortname in filename:
line = live_media_path_re.sub('', line)
line = line.rstrip() + ' live-media-path=/live/%s/ ' % (grml_flavour)
line = line.rstrip() + r' bootid=%s %s ' % (UUID, bootopt)
for regex in remove_regexes:
line = regex.sub(' ', line)
line = line.rstrip() + r' bootid=%s %s ' % (UUID, bootopt)
for regex in remove_regexes:
line = regex.sub(' ', line)
logging.debug('Unmounted %s' % efi_mountpoint)
os.rmdir(efi_mountpoint)
logging.debug('Removed directory %s' % efi_mountpoint)
logging.debug('Unmounted %s' % efi_mountpoint)
os.rmdir(efi_mountpoint)
logging.debug('Removed directory %s' % efi_mountpoint)
if options.force or os.path.exists(os.path.join(image, 'live')):
logging.info("Using %s as install base", image)
else:
if options.force or os.path.exists(os.path.join(image, 'live')):
logging.info("Using %s as install base", image)
else:
"Do you really want to use this image? y/N " % image)
if q.lower() == 'y':
logging.info("Using %s as install base", image)
"Do you really want to use this image? y/N " % image)
if q.lower() == 'y':
logging.info("Using %s as install base", image)
def install_grml(mountpoint, device):
"""Main logic for copying files of the currently running Grml system.
def install_grml(mountpoint, device):
"""Main logic for copying files of the currently running Grml system.
print("Forcing mkfs.fat16 on %s as requested via option --force." % device)
else:
# make sure the user is aware of what he is doing
print("Forcing mkfs.fat16 on %s as requested via option --force." % device)
else:
# make sure the user is aware of what he is doing
if not os.path.isdir(device) and not check_for_usbdevice(device) and not options.force:
print("Warning: the specified device %s does not look like a removable usb device." % device)
if not os.path.isdir(device) and not check_for_usbdevice(device) and not options.force:
print("Warning: the specified device %s does not look like a removable usb device." % device)
print("Instead of using grml2usb /path/to/iso %s you might" % device)
print("want to use grml2usb /path/to/iso /dev/... instead.")
print("Please check out the grml2usb manpage for details.")
print("Instead of using grml2usb /path/to/iso %s you might" % device)
print("want to use grml2usb /path/to/iso /dev/... instead.")
print("Please check out the grml2usb manpage for details.")
except Exception as error:
logging.critical("Fatal: %s", str(error))
except Exception as error:
logging.critical("Fatal: %s", str(error))