Use specified bootoptions as default.
+ *--bootloader-only*::
+
+Do *not* copy files but instead just install a bootloader.
+
+ *--copy-only*::
+
+Copy files only but do *not* install a bootloader.
+
*--dry-run*::
-Do not actually execute any commands, instead just show what would be executed.
+Avoid executing commands, instead show what would be executed.
+Warning: please notice that the ISO has to be mounted anyway, otherwise
+identifying the grml flavour would not be possible.
*--fat16*::
-Format specified partition with FAT16. **Important:** this will defstroy any existing
-data on the specified partition!
+Format specified partition with FAT16.
+**Important:** this will destroy any existing data on the specified partition!
*--force*::
-Force any actions requiring manual interaction (like --fat16, --mbr).
+Force any (possible dangerous) actions requiring manual interaction (like --fat16).
*--grub*::
-Install grub bootloader instead of syslinux.
+Install grub bootloader instead of syslinux. [Notice: not implemented yet.]
*--help*::
*--initrd=...*::
Install specified initrd instead of the default. You might want to specify
-option *--kernel* as well.
+option *--kernel* as well. (Be aware when using multiboot setup.)
+[Notice: not implemented yet.]
*--kernel=...*::
Install specified kernel instead of the default. You might want to specify
option *--initrd* as well. (Be aware when using multiboot setup.)
+[Notice: not implemented yet.]
+
+ *--lilo=...*::
+
+Use specified lilo executable to for installing master boot record (MBR)
+instead of the default, being /usr/share/grml2usb/lilo/lilo.static.
*--mbr*::
-Install master boot record (MBR) on the device.
+Install a default master boot record (MBR) on the device.
- *--squashfs=*::
+ *--quiet*::
-Install specified squashfs file as the default.
+Do not output anything but just errors on console.
- *--syslinux*::
+ *--squashfs=*::
-Install syslinux bootloader (default, requires FAT16 filesystem on the specified partition).
+Install specified squashfs file instead of the default.
+[Notice: not implemented yet.]
*--uninstall*::
Uninstall grml ISO files.
+[Notice: not implemented yet.]
*-v*, *--version*::
Introduction
------------
-grml2usb installs grml on a given partition on your usb device and makes it
+grml2usb installs grml on a given partition of your usb device and makes it
bootable.
+grml2usb provides multi-iso support, meaning you can specify several grml ISOs
+on the command line at once and select the grml flavour you would like to boot
+on the bootbrompt then. Notice that the default ISO (that's when pressing just
+enter on the bootprompt or wait until the timeout matches) will be the *first*
+one specified on the grml2usb command line.
+
Directory layout on usb device
------------------------------
# grml2usb /home/grml/grml_2008.11.iso /dev/sdb1
-Install specified ISOs on device /dev/sdb1.
+Install specified ISO on device /dev/sdb1.
# grml2usb /home/grml/grml_2008.11.iso /home/grml/grml_small_2008.11.iso /dev/sdb1
Install specified ISOs on device /dev/sdb1 for multibooting ISOs.
Note: boot "grml" as usual, for booting grml-small use "grml-small on the
-bootprompt, for grml64 use "grml64" and so on...
+bootprompt, for grml64 use "grml64" and so on... The *first* specified ISO is
+the one being the default (when just pressing enter or waiting until the timeout
+is reached).
# grml2usb --fat16 --mbr /home/grml/grml_2008.11.iso /dev/sdb1
----
* install memtest, dos, grub,... to /boot/addons/
-* implement missing options (--kernel, --initrd, --uninstall,...)
+* copy grml files to /grml/
+* implement missing options (--grub, --kernel, --initrd, --squashfs, --uninstall)
* code improvements:
- - improve error handling :)
- - get rid of all TODOs in code :)
+ - improve error handling wherever possible :)
+ - get rid of all TODOs in code
- use 'with open("...", "w") as f: ... f.write("...")'
- - simplify functions/code as much as possible -> audit
-* validate partition schema/layout: is the partition schema ok and the bootable flag set?
+ - simplify functions/code as much as possible (move stuff to further functions) -> audit
+* validate partition schema/layout: is the partition schema ok and the bootable flag set? (--validate?)
* implement logic for storing information about copied files -> register every file in a set()
* the last line in bootsplash (boot.msg) should mention all installed grml flavours
-* graphical version? :)
+* graphical version? any volunteers? :)
"""
from __future__ import with_statement
parser = OptionParser(usage=usage)
parser.add_option("--bootoptions", dest="bootoptions",
action="store", type="string",
- help="use specified bootoptions as defaut")
+ help="use specified bootoptions as default")
parser.add_option("--bootloader-only", dest="bootloaderonly", action="store_true",
- help="do not copy files only but just install a bootloader")
+ help="do not copy files but just install a bootloader")
parser.add_option("--copy-only", dest="copyonly", action="store_true",
- help="copy files only and do not install bootloader")
+ help="copy files only but do not install bootloader")
parser.add_option("--dry-run", dest="dryrun", action="store_true",
- help="do not actually execute any commands")
+ help="avoid executing commands")
parser.add_option("--fat16", dest="fat16", action="store_true",
help="format specified partition with FAT16")
parser.add_option("--force", dest="force", action="store_true",
help="force any actions requiring manual interaction")
parser.add_option("--grub", dest="grub", action="store_true",
- help="install grub bootloader instead of syslinux")
+ help="install grub bootloader instead of syslinux [TODO]")
parser.add_option("--initrd", dest="initrd", action="store", type="string",
- help="install specified initrd instead of the default")
+ help="install specified initrd instead of the default [TODO]")
parser.add_option("--kernel", dest="kernel", action="store", type="string",
- help="install specified kernel instead of the default")
+ help="install specified kernel instead of the default [TODO]")
parser.add_option("--lilo", dest="lilo", action="store", type="string",
help="lilo executable to be used for installing MBR")
parser.add_option("--mbr", dest="mbr", action="store_true",
help="install master boot record (MBR) on the device")
parser.add_option("--quiet", dest="quiet", action="store_true",
- help="do not output anything than errors on console")
+ help="do not output anything but just errors on console")
parser.add_option("--squashfs", dest="squashfs", action="store", type="string",
- help="install specified squashfs file instead of the default")
+ help="install specified squashfs file instead of the default [TODO]")
parser.add_option("--uninstall", dest="uninstall", action="store_true",
- help="remove grml ISO files")
+ help="remove grml ISO files from specified device [TODO]")
parser.add_option("--verbose", dest="verbose", action="store_true",
help="enable verbose mode")
parser.add_option("-v", "--version", dest="version", action="store_true",
if options.dryrun:
logging.info("Would copy files to %s", iso_mount)
elif not options.bootloaderonly:
- logging.info("Copying files. This might take a while....")
+ logging.info("Copying files. This might take a while....")
- squashfs = search_file(grml_flavour + '.squashfs', iso_mount)
- squashfs_target = target + '/live/'
- execute(mkdir, squashfs_target)
+ squashfs = search_file(grml_flavour + '.squashfs', iso_mount)
+ squashfs_target = target + '/live/'
+ execute(mkdir, squashfs_target)
- # use install(1) for now to make sure we can write the files afterwards as normal user as well
- logging.debug("cp %s %s" % (squashfs, target + '/live/' + grml_flavour + '.squashfs'))
- proc = subprocess.Popen(["install", "--mode=664", squashfs, squashfs_target + grml_flavour + ".squashfs"])
- proc.wait()
+ # use install(1) for now to make sure we can write the files afterwards as normal user as well
+ logging.debug("cp %s %s" % (squashfs, target + '/live/' + grml_flavour + '.squashfs'))
+ proc = subprocess.Popen(["install", "--mode=664", squashfs, squashfs_target + grml_flavour + ".squashfs"])
+ proc.wait()
- filesystem_module = search_file('filesystem.module', iso_mount)
- logging.debug("cp %s %s" % (filesystem_module, squashfs_target + grml_flavour + '.module'))
- proc = subprocess.Popen(["install", "--mode=664", filesystem_module, squashfs_target + grml_flavour + '.module'])
- proc.wait()
+ filesystem_module = search_file('filesystem.module', iso_mount)
+ logging.debug("cp %s %s" % (filesystem_module, squashfs_target + grml_flavour + '.module'))
+ proc = subprocess.Popen(["install", "--mode=664", filesystem_module, squashfs_target + grml_flavour + '.module'])
+ proc.wait()
- release_target = target + '/boot/release/' + grml_flavour
- execute(mkdir, release_target)
+ release_target = target + '/boot/release/' + grml_flavour
+ execute(mkdir, release_target)
- kernel = search_file('linux26', iso_mount)
- logging.debug("cp %s %s" % (kernel, release_target + '/linux26'))
- proc = subprocess.Popen(["install", "--mode=664", kernel, release_target + '/linux26'])
- proc.wait()
+ kernel = search_file('linux26', iso_mount)
+ logging.debug("cp %s %s" % (kernel, release_target + '/linux26'))
+ proc = subprocess.Popen(["install", "--mode=664", kernel, release_target + '/linux26'])
+ proc.wait()
- initrd = search_file('initrd.gz', iso_mount)
- logging.debug("cp %s %s" % (initrd, release_target + '/initrd.gz'))
- proc = subprocess.Popen(["install", "--mode=664", initrd, release_target + '/initrd.gz'])
- proc.wait()
+ initrd = search_file('initrd.gz', iso_mount)
+ logging.debug("cp %s %s" % (initrd, release_target + '/initrd.gz'))
+ proc = subprocess.Popen(["install", "--mode=664", initrd, release_target + '/initrd.gz'])
+ proc.wait()
if not options.copyonly:
syslinux_target = target + '/boot/syslinux/'
isos = args[0:len(args) - 1]
# make sure we can replace old grml2usb script and warn user when using old way of life:
- if device.startswith("/mnt/external") or device.startswith("/mnt/usb"):
+ if device.startswith("/mnt/external") or device.startswith("/mnt/usb") and not options.force:
print "Warning: the semantics of grml2usb has changed."
print "Instead of using grml2usb /path/to/iso %s you might" % device
print "want to use grml2usb /path/to/iso /dev/... instead."
sys.exit(1)
# make sure we have mkfs.vfat available
- if options.fat16:
+ if options.fat16 and not options.force:
if not which("mkfs.vfat") and not options.copyonly and not options.dryrun:
logging.critical('Sorry, mkfs.vfat not available. Exiting.')
- logging.critical('Please install dosfstools.')
+ logging.critical('Please make sure to install dosfstools.')
+ sys.exit(1)
+
+ # make sure the user is aware of what he is doing
+ f = raw_input("Are you sure you want to format the device with a fat16 filesystem? y/N ")
+ if f == "y" or f == "Y":
+ logging.info("Note: you can skip this question using the option --force")
+ mkfs_fat16(device)
+ else:
sys.exit(1)
# check for vfat filesystem