Index: head/sysutils/grub2-pcbsd/Makefile =================================================================== --- head/sysutils/grub2-pcbsd/Makefile (revision 377543) +++ head/sysutils/grub2-pcbsd/Makefile (revision 377544) @@ -1,95 +1,95 @@ # Created by: kmoore@FreeBSD.org # $FreeBSD$ PORTNAME= grub2-pcbsd PORTVERSION= 2.02p -PORTREVISION= 20 +PORTREVISION= 21 CATEGORIES= sysutils MASTER_SITES= http://www.pcbsd.org/~kris/software/ \ ftp://ftp.pcbsd.org/pub/software/ DISTNAME= grub-2.02_4 MAINTAINER= kmoore@FreeBSD.org COMMENT= Multiboot boot loader LICENSE= GPLv3 BUILD_DEPENDS= ${LOCALBASE}/bin/flex:${PORTSDIR}/textproc/flex \ ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash \ help2man:${PORTSDIR}/misc/help2man WRKSRC= ${WRKDIR}/grub-2.02 CONFLICTS= grub-0* grub2-2* SSP_UNSAFE= yes USE_GCC= yes USE_AUTOTOOLS= automake aclocal autoconf ACLOCAL_ARGS= -Im4 GNU_CONFIGURE= yes USES= bison gettext gmake makeinfo python tar:xz ONLY_FOR_ARCHS= i386 amd64 INFO= grub grub-dev MAKE_JOBS_UNSAFE= yes CONFIGURE_ARGS= --disable-werror --localedir=${PREFIX}/share/locale CONFIGURE_ENV= CPP="${CC} -E" \ LEX=${LOCALBASE}/bin/flex SUB_FILES= 00_header 10_kfreebsd 10_ktrueos 30_os-prober OPTIONS_DEFINE= MKFONT FUSE OPTIONS_DEFAULT=MKFONT MKFONT_DESC= Build grub-mkfont (require freetype2) FUSE_DESC= Build grub-mount (require FUSE) .include .if ${ARCH} != "amd64" EFIEMU= "@comment " .endif PLIST_SUB+= EFIEMU=${EFIEMU} .if ${PORT_OPTIONS:MMKFONT} LIB_DEPENDS+= libfreetype.so:${PORTSDIR}/print/freetype2 BUILD_DEPENDS+= ${LOCALBASE}/lib/X11/fonts/dejavu/DejaVuSans.ttf:${PORTSDIR}/x11-fonts/dejavu \ ${LOCALBASE}/lib/X11/fonts/local/unifont.pcf.gz:${PORTSDIR}/x11-fonts/gnu-unifont MAN1+= grub-mkfont.1 CONFIGURE_ARGS+= --enable-grub-mkfont .else CONFIGURE_ARGS+= --disable-grub-mkfont MKFONT= "@comment " .endif PLIST_SUB+= MKFONT=${MKFONT} .if ${PORT_OPTIONS:MFUSE} LIB_DEPENDS+= libfuse.so:${PORTSDIR}/sysutils/fusefs-libs CONFIGURE_ARGS+= --enable-grub-mount .else CONFIGURE_ARGS+= --disable-grub-mount FUSE= "@comment " .endif PLIST_SUB+= FUSE=${FUSE} post-patch: @${TOUCH} -t 200001010000 ${WRKSRC}/Makefile.util.def pre-configure: @${REINPLACE_CMD} -e 's|python|${PYTHON_CMD}|g' ${WRKSRC}/autogen.sh cd ${WRKSRC} && ./autogen.sh post-configure: @${LN} -sfh /usr/include/machine /usr/include/sys /usr/include/x86 ${WRKSRC}/grub-core post-install: @${RM} -rf ${STAGEDIR}${PREFIX}/lib/charset.alias @${INSTALL_SCRIPT} ${WRKDIR}/00_header ${STAGEDIR}${PREFIX}/etc/grub.d/ @${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 RUN_DEPENDS:= ${RUN_DEPENDS:Ngcc*} Index: head/sysutils/grub2-pcbsd/files/patch-geom-label-support =================================================================== --- head/sysutils/grub2-pcbsd/files/patch-geom-label-support (nonexistent) +++ head/sysutils/grub2-pcbsd/files/patch-geom-label-support (revision 377544) @@ -0,0 +1,182 @@ +diff --git a/grub-core/osdep/freebsd/getroot.c b/grub-core/osdep/freebsd/getroot.c +index ccc1d70..64c0aad 100644 +--- grub-core/osdep/freebsd/getroot.c ++++ grub-core/osdep/freebsd/getroot.c +@@ -296,6 +296,105 @@ grub_util_get_grub_dev_os (const char *os_dev) + return grub_dev; + } + ++int grub_util_check_geom_label(const char *name) ++{ ++ struct gmesh mesh; ++ struct gclass *class; ++ struct ggeom *geom; ++ struct gprovider *pp; ++ struct gprovider *pplabel; ++ struct gconsumer *cp; ++ const char *geom_name; ++ const char *test_name; ++ int err; ++ ++ err = geom_gettree (&mesh); ++ if (err != 0) ++ grub_util_error ("%s", _("couldn't open geom")); ++ ++ LIST_FOREACH (class, &mesh.lg_class, lg_class) ++ if (strcasecmp (class->lg_name, "label") == 0) ++ break; ++ if (!class) ++ grub_util_error ("%s", _("couldn't find geom `label' class")); ++ ++ if (strncmp (name, "/dev/", sizeof ("/dev/") - 1) == 0) ++ test_name = name + sizeof ("/dev/") - 1; ++ else ++ test_name = name; ++ ++ LIST_FOREACH (geom, &class->lg_geom, lg_geom) ++ { ++ LIST_FOREACH(pp, &geom->lg_provider, lg_provider) ++ { ++ geom_name = pp->lg_name; ++ if (strcasecmp (geom_name, test_name) != 0) ++ continue; ++ ++ LIST_FOREACH(cp, &geom->lg_consumer, lg_consumer) ++ { ++ pplabel = cp->lg_provider; ++ if (pplabel == NULL) ++ continue; ++ return 1; ++ } ++ } ++ } ++ return 0; ++} ++ ++const char * ++grub_util_convert_geom_label_to_dev (const char *name, int *full_path) ++{ ++ struct gmesh mesh; ++ struct gclass *class; ++ struct ggeom *geom; ++ struct gprovider *pp; ++ struct gprovider *pplabel; ++ struct gconsumer *cp; ++ static char buf[256]; ++ const char *geom_name; ++ int err; ++ ++ grub_util_info ("Converting label '%s' to device", name); ++ ++ err = geom_gettree (&mesh); ++ if (err != 0) ++ grub_util_error ("%s", _("couldn't open geom")); ++ ++ LIST_FOREACH (class, &mesh.lg_class, lg_class) ++ if (strcasecmp (class->lg_name, "label") == 0) ++ break; ++ if (!class) ++ grub_util_error ("%s", _("couldn't find geom `label' class")); ++ ++ ++ LIST_FOREACH (geom, &class->lg_geom, lg_geom) ++ { ++ LIST_FOREACH(pp, &geom->lg_provider, lg_provider) ++ { ++ geom_name = pp->lg_name; ++ if (strcasecmp (geom_name, name) != 0) ++ continue; ++ ++ LIST_FOREACH(cp, &geom->lg_consumer, lg_consumer) ++ { ++ pplabel = cp->lg_provider; ++ if (pplabel == NULL) ++ continue; ++ ++ if ( full_path ) ++ snprintf(buf, sizeof(buf), "/dev/%s", pplabel->lg_name); ++ else ++ snprintf(buf, sizeof(buf), "%s", pplabel->lg_name); ++ return buf; ++ } ++ } ++ } ++ grub_util_error ("%s", _("couldn't convert gptid to real device name")); ++ return 0; ++} ++ + /* FIXME: geom actually gives us the whole container hierarchy. + It can be used more efficiently than this. */ + void +diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c +index e3887cb..cd010ce 100644 +--- grub-core/osdep/unix/getroot.c ++++ grub-core/osdep/unix/getroot.c +@@ -504,6 +504,12 @@ grub_guess_root_devices (const char *dir_in) + if (!os_dev) + os_dev = find_root_devices_from_libzfs (dir); + ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++ if (os_dev) ++ if ( grub_util_check_geom_label(os_dev) ) ++ os_dev = grub_util_convert_geom_label_to_dev (os_dev + sizeof ("/dev/") - 1, 1); ++#endif ++ + if (os_dev) + { + char **cur; +diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h +index 73fa2d3..3c43db4 100644 +--- include/grub/emu/getroot.h ++++ include/grub/emu/getroot.h +@@ -44,6 +44,8 @@ char *grub_util_get_grub_dev (const char *os_dev); + #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) + void grub_util_follow_gpart_up (const char *name, grub_disk_addr_t *off_out, + char **name_out); ++int grub_util_check_geom_label(const char *name); ++const char *grub_util_convert_geom_label_to_dev (const char *name, int *full_path); + #endif + + #include +diff --git a/util/grub-install.c b/util/grub-install.c +index 7d61c32..5900535 100644 +--- util/grub-install.c ++++ util/grub-install.c +@@ -236,7 +236,16 @@ argp_parser (int key, char *arg, struct argp_state *state) + case ARGP_KEY_ARG: + if (install_device) + grub_util_error ("%s", _("More than one install device?")); ++#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) ++ /* Check if passing a FreeBSD geom label */ ++ if ( grub_util_check_geom_label(arg) ) ++ install_device = \ ++ xstrdup(grub_util_convert_geom_label_to_dev (arg + sizeof ("/dev/") - 1, 1)); ++ else + install_device = xstrdup (arg); ++#else ++ install_device = xstrdup (arg); ++#endif + return 0; + + default: +diff --git a/util/grub-probe.c b/util/grub-probe.c +index ecb7b6b..21e3fa3 100644 +--- util/grub-probe.c ++++ util/grub-probe.c +@@ -799,7 +799,16 @@ argp_parser (int key, char *arg, struct argp_state *state) + + case ARGP_KEY_ARG: + assert (arguments->ndevices < arguments->device_max); ++#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) ++ /* Check if passing a FreeBSD geom label */ ++ if ( grub_util_check_geom_label(arg) ) ++ arguments->devices[arguments->ndevices++] = \ ++ xstrdup(grub_util_convert_geom_label_to_dev (arg + sizeof ("/dev/") - 1, 1)); ++ else + arguments->devices[arguments->ndevices++] = xstrdup(arg); ++#else ++ arguments->devices[arguments->ndevices++] = xstrdup(arg); ++#endif + break; + + default: Property changes on: head/sysutils/grub2-pcbsd/files/patch-geom-label-support ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property