help="do not output anything but just errors on console")
parser.add_option("--remove-bootoption", dest="removeoption", action="append",
help="regex for removing existing bootoptions")
help="do not output anything but just errors on console")
parser.add_option("--remove-bootoption", dest="removeoption", action="append",
help="regex for removing existing bootoptions")
parser.add_option("--skip-addons", dest="skipaddons", action="store_true",
help="do not install /boot/addons/ files")
parser.add_option("--skip-bootflag", dest="skipbootflag", action="store_true",
parser.add_option("--skip-addons", dest="skipaddons", action="store_true",
help="do not install /boot/addons/ files")
parser.add_option("--skip-bootflag", dest="skipbootflag", action="store_true",
class CriticalException(Exception):
"""Throw critical exception if the exact error is not known but fatal.
class CriticalException(Exception):
"""Throw critical exception if the exact error is not known but fatal.
+def set_rw(device):
+ if not options.rwblockdev:
+ return
+
+ logging.debug("executing: blockdev --setrw %s", device)
+ proc = subprocess.Popen(["blockdev", "--setrw", device])
+ proc.wait()
+ if proc.returncode != 0:
+ raise Exception("error executing blockdev on %s" % device)
+
+
def execute(f, *exec_arguments):
"""Wrapper for executing a command. Either really executes
the command (default) or when using --dry-run commandline option
def execute(f, *exec_arguments):
"""Wrapper for executing a command. Either really executes
the command (default) or when using --dry-run commandline option
"""
bootloader_dirs = ['/boot/isolinux/', '/boot/syslinux/']
for directory in bootloader_dirs:
"""
bootloader_dirs = ['/boot/isolinux/', '/boot/syslinux/']
for directory in bootloader_dirs:
logging.info("Installing grub as bootloader")
for opt in ["", "--force"]:
logging.debug("grub-install --recheck %s --no-floppy --root-directory=%s %s",
logging.info("Installing grub as bootloader")
for opt in ["", "--force"]:
logging.debug("grub-install --recheck %s --no-floppy --root-directory=%s %s",
- logging.critical("Fatal: error executing grub-install "
- + "(please check the grml2usb FAQ or drop the --grub option)")
- logging.critical("Note: if using grub2 consider using "
- + "the --grub-mbr option as grub considers PBR problematic.")
+ logging.critical("Fatal: error executing grub-install " +
+ "(please check the grml2usb FAQ or drop the --grub option)")
+ logging.critical("Note: if using grub2 consider using " +
+ "the --grub-mbr option as grub considers PBR problematic.")
# syslinux -d boot/isolinux /dev/sdb1
logging.info("Installing syslinux as bootloader")
logging.debug("syslinux -d boot/syslinux %s", device)
# syslinux -d boot/isolinux /dev/sdb1
logging.info("Installing syslinux as bootloader")
logging.debug("syslinux -d boot/syslinux %s", device)
logging.debug("executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc", tmpf.name, device)
proc = subprocess.Popen(["dd", "if=%s" % tmpf.name, "of=%s" % device, "bs=512", "count=1",
"conv=notrunc"], stderr=file(os.devnull, "r+"))
logging.debug("executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc", tmpf.name, device)
proc = subprocess.Popen(["dd", "if=%s" % tmpf.name, "of=%s" % device, "bs=512", "count=1",
"conv=notrunc"], stderr=file(os.devnull, "r+"))
- raise CriticalException("Error executing mount: %s already mounted - " % source
- + "please unmount before invoking grml2usb")
+ raise CriticalException("Error executing mount: %s already mounted - " % source +
+ "please unmount before invoking grml2usb")
if os.path.isdir(source):
logging.debug("Source %s is not a device, therefore not mounting.", source)
return 0
if os.path.isdir(source):
logging.debug("Source %s is not a device, therefore not mounting.", source)
return 0
logging.debug("mount %s %s %s", mount_options, source, target)
proc = subprocess.Popen(["mount"] + list(mount_options) + [source, target])
proc.wait()
logging.debug("mount %s %s %s", mount_options, source, target)
proc = subprocess.Popen(["mount"] + list(mount_options) + [source, target])
proc.wait()
logging.warning("Warning: Grml releases older than 2011.12 support only one flavour in grub.")
for expr in name, 'distri.cfg', \
logging.warning("Warning: Grml releases older than 2011.12 support only one flavour in grub.")
for expr in name, 'distri.cfg', \
- defaults_file, 'grml.png', 'hd.cfg', 'isolinux.cfg', 'isolinux.bin', \
- 'isoprompt.cfg', 'options.cfg', \
- 'prompt.cfg', 'vesamenu.cfg', 'grml.png', '*.c32':
+ defaults_file, 'grml.png', 'hd.cfg', 'isolinux.cfg', 'isolinux.bin', \
+ 'isoprompt.cfg', 'options.cfg', \
+ 'prompt.cfg', 'vesamenu.cfg', 'grml.png', '*.c32':
glob_and_copy(iso_mount + source_dir + expr, syslinux_target)
for filename in glob.glob1(syslinux_target, "*.c32"):
glob_and_copy(iso_mount + source_dir + expr, syslinux_target)
for filename in glob.glob1(syslinux_target, "*.c32"):
- logging.critical("Fatal: grub-install not available (please install the "
- + "grub package or drop the --grub option)")
+ logging.critical("Fatal: grub-install not available (please install the " +
+ "grub package or drop the --grub option)")
- logging.critical("Fatal: syslinux not available (please install the "
- + "syslinux package or use the --grub option)")
+ logging.critical("Fatal: syslinux not available (please install the " +
+ "syslinux package or use the --grub option)")