aboutsummaryrefslogtreecommitdiff
path: root/sysutils/grub2-pcbsd
diff options
context:
space:
mode:
authorKris Moore <kmoore@FreeBSD.org>2014-10-22 17:02:59 +0000
committerKris Moore <kmoore@FreeBSD.org>2014-10-22 17:02:59 +0000
commitbe6fb223ffdc37a325e11ab0ea5a44ff019bc9f3 (patch)
treef3d6507745bcdd55fedc65b9e3f4010eab8da1ac /sysutils/grub2-pcbsd
parentfc6c6e172d1699021eca70d74bb0414e2834a1a7 (diff)
downloadports-be6fb223ffdc37a325e11ab0ea5a44ff019bc9f3.tar.gz
ports-be6fb223ffdc37a325e11ab0ea5a44ff019bc9f3.zip
- 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
Notes
Notes: svn path=/head/; revision=371362
Diffstat (limited to 'sysutils/grub2-pcbsd')
-rw-r--r--sysutils/grub2-pcbsd/Makefile3
-rw-r--r--sysutils/grub2-pcbsd/files/00_header.in22
-rw-r--r--sysutils/grub2-pcbsd/files/10_ktrueos.in15
-rw-r--r--sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c18
-rw-r--r--sysutils/grub2-pcbsd/pkg-install22
-rw-r--r--sysutils/grub2-pcbsd/pkg-plist2
6 files changed, 59 insertions, 23 deletions
diff --git a/sysutils/grub2-pcbsd/Makefile b/sysutils/grub2-pcbsd/Makefile
index b60c10b1f515..d2462a4f3887 100644
--- a/sysutils/grub2-pcbsd/Makefile
+++ b/sysutils/grub2-pcbsd/Makefile
@@ -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>
diff --git a/sysutils/grub2-pcbsd/files/00_header.in b/sysutils/grub2-pcbsd/files/00_header.in
index d88fb4196159..346f5e0dacbe 100644
--- a/sysutils/grub2-pcbsd/files/00_header.in
+++ b/sysutils/grub2-pcbsd/files/00_header.in
@@ -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
diff --git a/sysutils/grub2-pcbsd/files/10_ktrueos.in b/sysutils/grub2-pcbsd/files/10_ktrueos.in
index 8cf299aa8dea..31b0cfde8de7 100644
--- a/sysutils/grub2-pcbsd/files/10_ktrueos.in
+++ b/sysutils/grub2-pcbsd/files/10_ktrueos.in
@@ -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()
diff --git a/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c b/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
index 533533e6529c..9dd42058df5c 100644
--- a/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
+++ b/sysutils/grub2-pcbsd/files/patch-grub-core_disk_geli.c
@@ -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");
diff --git a/sysutils/grub2-pcbsd/pkg-install b/sysutils/grub2-pcbsd/pkg-install
new file mode 100644
index 000000000000..87e013c76d49
--- /dev/null
+++ b/sysutils/grub2-pcbsd/pkg-install
@@ -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
+
diff --git a/sysutils/grub2-pcbsd/pkg-plist b/sysutils/grub2-pcbsd/pkg-plist
index d4760f3db43d..e6941b91ec08 100644
--- a/sysutils/grub2-pcbsd/pkg-plist
+++ b/sysutils/grub2-pcbsd/pkg-plist
@@ -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