import struct
# global variables
-PROG_VERSION = "0.9.25"
+PROG_VERSION = "0.9.26"
MOUNTED = set() # register mountpoints
TMPFILES = set() # register tmpfiles
DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg
# by default we use grub, so install syslinux only on request
if options.grub:
- if not which("grub-install"):
- logging.critical("Fatal: grub-install not available (please install the "
- + "grub package or use the --syslinux option)")
+ try:
+ install_grub(device)
+ except CriticalException, error:
+ logging.critical("Fatal: %s", error)
cleanup()
sys.exit(1)
- else:
- try:
- install_grub(device)
- except CriticalException, error:
- logging.critical("Fatal: %s", error)
- cleanup()
- sys.exit(1)
else:
try:
install_syslinux(device)
for x in file('/proc/mounts').readlines():
if x.startswith(source):
- raise CriticalException("Error executing mount: %s already mounted - "
- + "please unmount before invoking grml2usb" % source)
+ 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)
" (wrong UID/permissions or device/directory not present?)" % partition)
if filesystem != "vfat":
- raise CriticalException("Partition %s does not contain a FAT16 filesystem. "
- + "(Use --fat16 or run mkfs.vfat %s)" % (partition, partition))
+ raise CriticalException(
+ "Partition %s does not contain a FAT16 filesystem." % (partition) \
+ + "(Use --fat16 or run mkfs.vfat %s)" % (partition))
except OSError:
raise CriticalException("Sorry, /sbin/blkid not available (install e2fsprogs?)")
if options.dryrun:
logging.info("Running in simulation mode as requested via option dry-run.")
-
# specified arguments
device = args[len(args) - 1]
isos = args[0:len(args) - 1]
logging.critical("Fatal: installation on raw device not supported. (BIOS won't support it.)")
sys.exit(1)
+ if options.grub:
+ if not which("grub-install"):
+ logging.critical("Fatal: grub-install not available (please install the "
+ + "grub package or drop the --grub option)")
+ sys.exit(1)
+
+ if options.syslinux:
+ if not which("syslinux"):
+ logging.critical("Fatal: syslinux not available (please install the "
+ + "syslinux package or use the --grub option)")
+ sys.exit(1)
+
if not which("rsync"):
logging.critical("Fatal: rsync not available, can not continue - sorry.")
sys.exit(1)