Add support for memtest image
[grml2usb.git] / grml2usb
index 5f01825..b57d6cc 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -10,22 +10,6 @@ This script installs a grml system (either a running system or ISO[s]) to a USB
 :license: GPL v2 or any later version
 :bugreports: http://grml.org/bugs/
 
-TODO
-----
-
-* implement missing options (--grub, --kernel, --initrd, --squashfs, --uninstall)
-* validate partition schema/layout: is the partition schema ok and the bootable flag set? (--validate?)
-* provide --create-partition option?
-* 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
-* code improvements:
-  - improve error handling wherever possible :)
-  - use 'with open("...", "w") as f: ... f.write("...")'
-  - simplify functions/code as much as possible, especially:
-    Too many local variables
-    Too many branches
-    Too many statements
-* graphical version? any volunteers? :)
 """
 
 from __future__ import with_statement
@@ -308,7 +292,6 @@ APPEND initrd=/boot/release/%(grml_flavour)s/initrd.gz apm=power-off boot=live n
 # memtest
 LABEL  memtest
 KERNEL /boot/addons/memtest
-#APPEND BOOT_IMAGE=memtest
 
 # grub
 LABEL grub
@@ -710,7 +693,7 @@ def copy_addons(iso_mount, target):
         proc = subprocess.Popen(["install", "--mode=664", balderimg, addons + 'balder10.imz'])
         proc.wait()
 
-    # memtest86+ image
+    # memdisk image
     memdiskimg = search_file('memdisk', iso_mount)
     if memdiskimg is None:
         logging.warn("Warning: memdisk not found - can not install it")
@@ -719,6 +702,15 @@ def copy_addons(iso_mount, target):
         proc = subprocess.Popen(["install", "--mode=664", memdiskimg, addons + 'memdisk'])
         proc.wait()
 
+    # memtest86+ image
+    memtestimg = search_file('memtest', iso_mount)
+    if memtestimg is None:
+        logging.warn("Warning: memtest not found - can not install it")
+    else:
+        logging.debug("cp %s %s" % (memtestimg, addons + '/memtest'))
+        proc = subprocess.Popen(["install", "--mode=664", memtestimg, addons + 'memtest'])
+        proc.wait()
+
 
 def copy_bootloader_files(iso_mount, target):
     """"TODO"""
@@ -1006,10 +998,6 @@ def handle_vfat(device):
         else:
             sys.exit(1)
 
-    # format partition:
-    if options.fat16:
-        mkfs_fat16(device)
-
 
 def handle_compat_warning(device):
     """TODO"""