Merge remote-tracking branch 'origin/pr/16'
authorMichael Prokop <mika@grml.org>
Fri, 25 May 2018 18:39:40 +0000 (20:39 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 25 May 2018 18:39:40 +0000 (20:39 +0200)
debian/changelog
debian/control
doc/mbr.8.txt
grml2iso.8.txt
grml2usb
grml2usb.8.txt

index b62b61e..dac78a2 100644 (file)
@@ -1,3 +1,23 @@
+grml2usb (0.16.1) unstable; urgency=medium
+
+  * [7ca80ac] Fix a bunch of typos
+  * [5e37e24] Bump Standards-Version to 4.1.4
+
+ -- Michael Prokop <mika@grml.org>  Fri, 25 May 2018 13:54:59 +0200
+
+grml2usb (0.16.0) unstable; urgency=medium
+
+  * [70c9de3] Provide Secure Boot support
+
+ -- Michael Prokop <mika@grml.org>  Thu, 07 Sep 2017 09:40:59 +0200
+
+grml2usb (0.15.4) unstable; urgency=medium
+
+  * [976735f] Bump Standards-Version to 4.0.1
+  * Upload to Debian unstable now that stretch is stable.
+
+ -- Michael Prokop <mika@grml.org>  Thu, 17 Aug 2017 14:50:03 +0200
+
 grml2usb (0.15.3) experimental; urgency=medium
 
   * [9cbb231] Option --rw-blockdev: set r/w also in GRUB specific steps.
index 91524e7..347dbe9 100644 (file)
@@ -10,7 +10,7 @@ Build-Depends: asciidoc,
                debhelper (>= 10~),
                docbook-xsl,
                xsltproc
-Standards-Version: 3.9.8
+Standards-Version: 4.1.4
 Homepage: http://grml.org/grml2usb/
 Vcs-git: git://git.grml.org/grml2usb.git
 Vcs-Browser: https://git.grml.org/?p=grml2usb.git
index 4460b04..259a033 100644 (file)
@@ -93,7 +93,7 @@ Write new, clean MBR:
 USB modes
 ---------
 
-  * USB-HDD: usually the default and prefered booting mode.
+  * USB-HDD: usually the default and preferred booting mode.
   * USB-ZIP: ??? - can be set up via:
 
     # mkdiskimage -4    /dev/sdz 1  64 32 # device = 1GB
index 124b5af..14bbdd4 100644 (file)
@@ -97,8 +97,8 @@ Use /mnt/test/grml-tmp as working directory for creating the multiboot ISO
 Don't copy the addons from the specified ISO images
 
 
-Online Ressources
------------------
+Online Resources
+----------------
 
 Check out the link:http://grml.org/grml2usb/[grml2usb webpage] and the
 link:http://git.grml.org/?p=grml2usb.git[grml2usb git repository].
index dda9453..4fc9b37 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -245,7 +245,7 @@ def unregister_mountpoint(target):
 
 
 def get_function_name(obj):
-    """Helper function for use in execute() to retrive name of a function
+    """Helper function for use in execute() to retrieve name of a function
 
     @obj: the function object
     """
@@ -1119,6 +1119,7 @@ def copy_bootloader_files(iso_mount, target, grml_flavour):
     if efi_img:
         mkdir(target + '/boot/')
         exec_rsync(efi_img, target + '/boot/efi.img')
+        handle_secure_boot(target, efi_img)
 
     for ffile in ['f%d' % number for number in range(1, 11)]:
         search_and_copy(ffile, iso_mount, syslinux_target + ffile)
@@ -1157,7 +1158,7 @@ def copy_bootloader_files(iso_mount, target, grml_flavour):
     # copy all grub files from ISO
     glob_and_copy(iso_mount + '/boot/grub/*', grub_target)
 
-    # finally (after all GRUB files have been been installed) build static loopback.cfg
+    # finally (after all GRUB files have been installed) build static loopback.cfg
     build_loopbackcfg(target)
 
 
@@ -1275,6 +1276,7 @@ def handle_grub_config(grml_flavour, device, target):
     logging.debug("Updating grub configuration")
 
     grub_target = target + '/boot/grub/'
+    secureboot_target = target + '/EFI/ubuntu/'
 
     bootid_re = re.compile("bootid=[\w_-]+")
     live_media_path_re = re.compile("live-media-path=[\w_/-]+")
@@ -1289,7 +1291,7 @@ def handle_grub_config(grml_flavour, device, target):
             remove_regexes.append(re.compile(regex))
 
     shortname = get_shortname(grml_flavour)
-    for filename in glob.glob(grub_target + '*.cfg'):
+    for filename in glob.glob(grub_target + '*.cfg') + glob.glob(secureboot_target + '*.cfg'):
         for line in fileinput.input(filename, inplace=1):
             line = line.rstrip("\r\n")
             if option_re.search(line):
@@ -1305,7 +1307,7 @@ def handle_grub_config(grml_flavour, device, target):
 
 
 def initial_syslinux_config(target):
-    """Generates intial syslinux configuration
+    """Generates initial syslinux configuration
 
     @target path of syslinux's configuration files"""
 
@@ -1509,6 +1511,51 @@ def handle_syslinux_config(grml_flavour, target):
     add_syslinux_entry("%s/additional.cfg" % syslinux_target, flavour_filename)
 
 
+def handle_secure_boot(target, efi_img):
+    """Provide secure boot support by extracting files from /boot/efi.img
+
+    @target: path where grml's main files should be copied to
+    @efi_img: path to the efi.img file that includes the files for secure boot
+    """
+
+    mkdir(target + '/efi/boot/')
+    efi_mountpoint = tempfile.mkdtemp(prefix="grml2usb", dir=os.path.abspath(options.tmpdir))
+    logging.debug("efi_mountpoint = %s" % efi_mountpoint)
+    register_tmpfile(efi_mountpoint)
+
+    try:
+        logging.debug("mount(%s, %s, ['-o', 'ro', '-t', 'vfat']" % (efi_img, efi_mountpoint))
+        mount(efi_img, efi_mountpoint, ['-o', 'ro', '-t', 'vfat'])
+    except CriticalException as error:
+        logging.critical("Fatal: %s", error)
+        sys.exit(1)
+
+    ubuntu_cfg = search_file('grub.cfg', efi_mountpoint + '/EFI/ubuntu')
+    logging.debug("ubuntu_cfg = %s" % ubuntu_cfg)
+    if not ubuntu_cfg:
+        logging.info("No /EFI/ubuntu/grub.cfg found inside EFI image, looks like Secure Boot support is missing.")
+    else:
+        mkdir(target + '/efi/ubuntu')
+        logging.debug("exec_rsync(%s, %s + '/efi/ubuntu/grub.cfg')" % (ubuntu_cfg, target))
+        exec_rsync(ubuntu_cfg, target + '/efi/ubuntu/grub.cfg')
+
+        logging.debug("exec_rsync(%s + '/EFI/BOOT/grubx64.efi', %s + '/efi/boot/grubx64.efi')'" % (efi_mountpoint, target))
+        exec_rsync(efi_mountpoint + '/EFI/BOOT/grubx64.efi', target + '/efi/boot/grubx64.efi')
+
+        # NOTE - we're overwriting /efi/boot/bootx64.efi from copy_bootloader_files here
+        logging.debug("exec_rsync(%s + '/EFI/BOOT/bootx64.efi', %s + '/efi/boot/bootx64.efi')'" % (efi_mountpoint, target))
+        exec_rsync(efi_mountpoint + '/EFI/BOOT/bootx64.efi', target + '/efi/boot/bootx64.efi')
+
+    try:
+        unmount(efi_mountpoint, "")
+        logging.debug('Unmounted %s' % efi_mountpoint)
+        os.rmdir(efi_mountpoint)
+        logging.debug('Removed directory %s' % efi_mountpoint)
+    except StandardError:
+        logging.critical('RuntimeError while umount %s' % efi_mountpoint)
+        sys.exit(1)
+
+
 def handle_bootloader_config(grml_flavour, device, target):
     """Main handler for generating bootloader's configuration
 
@@ -1766,7 +1813,7 @@ def handle_bootloader(device):
 
 
 def check_options(opts):
-    """Check compability of provided user opts
+    """Check compatibility of provided user opts
 
     @opts option dict from OptionParser
     """
index bd13742..c908763 100644 (file)
@@ -631,9 +631,9 @@ Install specified ISOs on device /dev/sdx and add parameter persistent-path
 to every menu entry. %flavour_name will be expanded to the flavour of the specific
 iso, e.g. grml64 and grml.
 
-[[ressources]]
-Online Ressources
------------------
+[[resources]]
+Online Resources
+----------------
 
 Check out the link:http://grml.org/grml2usb/[grml2usb webpage] and the
 link:http://git.grml.org/?p=grml2usb.git[grml2usb git repository].