help="do not install a master boot record (MBR) on the device")
parser.add_option("--skip-syslinux-config", dest="skipsyslinuxconfig", action="store_true",
help="skip generation of syslinux configuration files")
+parser.add_option("--skip-usb-check", dest="skipusbcheck", action="store_true",
+ help="skip check to verify whether given device is removable")
parser.add_option("--syslinux", dest="syslinux", action="callback", default=True,
callback=syslinux_warning,
help="install syslinux bootloader (deprecated as it's the default)")
boot_dev, x = get_device_from_partition(device)
try:
+ import parted
part = get_partition_for_path(device)
if part.getFlag(parted.PARTITION_BOOT):
logging.debug("bootflag is enabled on %s" % device)
for opt in ["", "--force"]:
logging.debug("grub-install --recheck %s --no-floppy --root-directory=%s %s",
opt, device_mountpoint, grub_device)
- proc = subprocess.Popen([GRUB_INSTALL, "--recheck", opt, "--no-floppy",
+ proc = subprocess.Popen([GRUB_INSTALL, "--recheck", opt,
+ "--no-floppy", "--target=i386-pc",
"--root-directory=%s" % device_mountpoint, grub_device],
stdout=file(os.devnull, "r+"))
proc.wait()
raise Exception("error executing dd (third run)")
del tmpf
+ # make sure we sync filesystems before returning
+ proc = subprocess.Popen(["sync"])
+ proc.wait()
+
def is_writeable(device):
"""Check if the device is writeable for the current user
logging.critical("Execution failed: %s", error)
sys.exit(1)
+ if options.skipusbcheck:
+ logging.info("Not checking for removable USB device as requested via option --skip-usb-check.")
+ return
+
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)
f = raw_input("Do you really want to continue? y/N ")
if opts.grubmbr and not opts.grub:
raise CriticalException("--grub-mbr requires --grub option.")
+ if opts.copyonly and opts.grub:
+ raise CriticalException("Cannot use --copy-only and --grub at the same time.")
+
def check_programs():
"""check if all needed programs are installed"""