Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2014 17:03:00 +0000 (UTC)
From:      Kris Moore <kmoore@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r371362 - in head/sysutils/grub2-pcbsd: . files
Message-ID:  <201410221703.s9MH30Es059203@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmoore
Date: Wed Oct 22 17:02:59 2014
New Revision: 371362
URL: https://svnweb.freebsd.org/changeset/ports/371362
QAT: https://qat.redports.org/buildarchive/r371362/

Log:
   - Add GELI passphrase passthrough support to default grub.cfg
   - Add detection for EFI mode at boot
   - Don't clobber ${PREFIX}/etc/grub.d/40_custom on re-install
   - Bump PORTREV

Added:
  head/sysutils/grub2-pcbsd/pkg-install   (contents, props changed)
Modified:
  head/sysutils/grub2-pcbsd/Makefile
  head/sysutils/grub2-pcbsd/files/00_header.in
  head/sysutils/grub2-pcbsd/files/10_ktrueos.in
  head/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
  head/sysutils/grub2-pcbsd/pkg-plist

Modified: head/sysutils/grub2-pcbsd/Makefile
==============================================================================
--- head/sysutils/grub2-pcbsd/Makefile	Wed Oct 22 16:25:55 2014	(r371361)
+++ head/sysutils/grub2-pcbsd/Makefile	Wed Oct 22 17:02:59 2014	(r371362)
@@ -3,7 +3,7 @@
 
 PORTNAME=	grub2-pcbsd
 PORTVERSION=	2.02p
-PORTREVISION=	8
+PORTREVISION=	9
 CATEGORIES=	sysutils
 MASTER_SITES=   http://www.pcbsd.org/~kris/software/ \
 		ftp://ftp.pcbsd.org/pub/software/
@@ -88,6 +88,7 @@ post-install:
 	@${INSTALL_SCRIPT} ${WRKDIR}/10_kfreebsd ${STAGEDIR}${PREFIX}/etc/grub.d/
 	@${INSTALL_SCRIPT} ${WRKDIR}/10_ktrueos ${STAGEDIR}${PREFIX}/etc/grub.d/
 	@${INSTALL_SCRIPT} ${WRKDIR}/30_os-prober ${STAGEDIR}${PREFIX}/etc/grub.d/
+	@${MV} ${STAGEDIR}${PREFIX}/etc/grub.d/40_custom ${STAGEDIR}/${PREFIX}/etc/grub.d/40_custom.dist
 
 .include <bsd.port.post.mk>
 

Modified: head/sysutils/grub2-pcbsd/files/00_header.in
==============================================================================
--- head/sysutils/grub2-pcbsd/files/00_header.in	Wed Oct 22 16:25:55 2014	(r371361)
+++ head/sysutils/grub2-pcbsd/files/00_header.in	Wed Oct 22 17:02:59 2014	(r371362)
@@ -104,6 +104,11 @@ fi
 
 export menuentry_id_option
 
+if [ x"\${gelipassphrase}" != x ]; then
+  set pass=\$gelipassphrase
+  export pass
+fi
+
 if [ "\${prev_saved_entry}" ]; then
   set saved_entry="\${prev_saved_entry}"
   save_env saved_entry
@@ -206,9 +211,20 @@ EOF
 	fi
 
     cat << EOF
-  set gfxmode=${GRUB_GFXMODE}
-  load_video
-  insmod gfxterm
+  if [ x"\${grub_platform}" = xpc ] ; then
+    set gfxmode=${GRUB_GFXMODE}
+    load_video
+    insmod gfxterm
+  else
+    # EFI
+    insmod efi_gop
+    insmod gfxterm
+    insmod font
+    insmod videotest
+    insmod videoinfo
+    set gfxmode=${GRUB_GFXMODE}
+    set gfxpayload=vga=normal
+  fi
 EOF
 
 # Gettext variables and module

Modified: head/sysutils/grub2-pcbsd/files/10_ktrueos.in
==============================================================================
--- head/sysutils/grub2-pcbsd/files/10_ktrueos.in	Wed Oct 22 16:25:55 2014	(r371361)
+++ head/sysutils/grub2-pcbsd/files/10_ktrueos.in	Wed Oct 22 17:02:59 2014	(r371362)
@@ -90,6 +90,9 @@ display_loaderopts()
      rm /tmp/.sObjs.$$
   done
 
+  # Using GELI encryption?
+  haveGELI="false"
+
   # Now lets echo out the modules to load
   if [ "$haveObjs" = "1" ] ; then
     while read line
@@ -108,6 +111,10 @@ display_loaderopts()
         echo "$line" >> /tmp/.lSysCtls.$$
         continue
       fi
+
+      # Are we loading GELI module?
+      if [ "$module" = "geom_eli" ] ; then haveGELI="true" ; fi
+
       echo "    kfreebsd_module_elf ${loadPrefix}/@/boot/${mPath}/${module}.ko"
     done < /tmp/.lRObjs.$$
   fi
@@ -131,6 +138,14 @@ display_loaderopts()
      umount /mnt.$$ >/dev/null
      rmdir /mnt.$$ >/dev/null
   fi
+
+  # Set the grub.platform kenv variable
+  echo "    set kFreeBSD.grub.platform=\$grub_platform"
+
+  # See if we need to do GELI passphrase passthrough
+  if [ "$haveGELI" = "true" ] ; then
+    echo "    set kFreeBSD.kern.geom.eli.passphrase=\$pass"
+  fi
 }
 
 detect_beadm()

Modified: head/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
==============================================================================
--- head/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c	Wed Oct 22 16:25:55 2014	(r371361)
+++ head/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c	Wed Oct 22 17:02:59 2014	(r371362)
@@ -1,23 +1,5 @@
 --- grub-core/disk/geli.c.orig	2014-05-15 14:00:10.000000000 -0400
 +++ grub-core/disk/geli.c	2014-09-26 10:18:53.325111693 -0400
-@@ -225,7 +225,7 @@
- 
-   /* Look for GELI magic sequence.  */
-   if (grub_memcmp (header->magic, GELI_MAGIC, sizeof (GELI_MAGIC))
--      || grub_le_to_cpu32 (header->version) > 5
-+      || grub_le_to_cpu32 (header->version) > 7
-       || grub_le_to_cpu32 (header->version) < 1)
-     grub_util_error ("%s", _("wrong ELI magic or version"));
- 
-@@ -265,7 +265,7 @@
- 
-   /* Look for GELI magic sequence.  */
-   if (grub_memcmp (header.magic, GELI_MAGIC, sizeof (GELI_MAGIC))
--      || grub_le_to_cpu32 (header.version) > 5
-+      || grub_le_to_cpu32 (header.version) > 7
-       || grub_le_to_cpu32 (header.version) < 1)
-     {
-       grub_dprintf ("geli", "wrong magic %02x\n", header.magic[0]);
 @@ -430,6 +430,9 @@
    if (!grub_password_get (passphrase, MAX_PASSPHRASE))
      return grub_error (GRUB_ERR_BAD_ARGUMENT, "Passphrase not supplied");

Added: head/sysutils/grub2-pcbsd/pkg-install
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/grub2-pcbsd/pkg-install	Wed Oct 22 17:02:59 2014	(r371362)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+PREFIX=${PKG_PREFIX-/usr/local}
+
+if [ "$2" != "POST-INSTALL" ] ; then
+   exit 0
+fi
+
+# If this is during staging, we can skip for now
+echo $PREFIX | grep -q '/stage/'
+if [ $? -eq 0 ] ; then
+   exit 0
+fi
+
+# Copy over user-editable 40_custom script
+if [ ! -e "${PREFIX}/etc/grub.d/40_custom" ] ; then
+   cp ${PREFIX}/etc/grub.d/40_custom.dist ${PREFIX}/etc/grub.d/40_custom
+   chmod 755 ${PREFIX}/etc/grub.d/40_custom
+fi
+
+exit 0
+

Modified: head/sysutils/grub2-pcbsd/pkg-plist
==============================================================================
--- head/sysutils/grub2-pcbsd/pkg-plist	Wed Oct 22 16:25:55 2014	(r371361)
+++ head/sysutils/grub2-pcbsd/pkg-plist	Wed Oct 22 17:02:59 2014	(r371362)
@@ -155,7 +155,7 @@ man/man1/grub-syslinux2cfg.1.gz
 man/man8/grub-macbless.8.gz
 etc/grub.d/00_header
 etc/grub.d/30_os-prober
-etc/grub.d/40_custom
+etc/grub.d/40_custom.dist
 etc/grub.d/41_custom
 etc/grub.d/10_kfreebsd
 etc/grub.d/10_ktrueos



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410221703.s9MH30Es059203>