summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <scarabeus@gentoo.org>2011-05-15 14:46:49 +0200
committerTomas Chvatal <scarabeus@gentoo.org>2011-05-15 14:46:49 +0200
commit524abd91dc3dfc13977dffee87e09a1c233055f1 (patch)
treecdc210bfbbe965f6036379476dac4be79f905ac3
parentDrop. In main tree. (diff)
downloadscarabeus-524abd91dc3dfc13977dffee87e09a1c233055f1.tar.gz
scarabeus-524abd91dc3dfc13977dffee87e09a1c233055f1.tar.bz2
scarabeus-524abd91dc3dfc13977dffee87e09a1c233055f1.zip
[sys-boot/grub] Add my version of grub2.
-rw-r--r--sys-boot/grub/Manifest4
-rw-r--r--sys-boot/grub/grub-1.99.ebuild137
-rw-r--r--sys-boot/grub/grub-9999.ebuild137
-rw-r--r--sys-boot/grub/metadata.xml9
4 files changed, 287 insertions, 0 deletions
diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
new file mode 100644
index 0000000..1f1fdcf
--- /dev/null
+++ b/sys-boot/grub/Manifest
@@ -0,0 +1,4 @@
+DIST grub-1.99.tar.xz 2639224 RMD160 d59a47fa40b2be0d5ea5b2b00ff5538cfa147747 SHA1 a5ae9558f30ce7757a76aa130088b053a87e2fb6 SHA256 f308148d4c83c6f16a73b58a0cd39381656edb740929028cae7ad5f0d651021b
+EBUILD grub-1.99.ebuild 3727 RMD160 76994633ddc444cde38a2ac41a13fe6a5362ac74 SHA1 4c74a17f01716a272dcff339ef4e4526879db957 SHA256 00a3165b63901a09990470ee2d62541250c23d5e3a88a59c3958d39d6effd2a5
+EBUILD grub-9999.ebuild 3716 RMD160 ad966e0da4664a4f062240d069e9aa3169c1a47e SHA1 d5b68443369e354efa56c4d444cf640a829816cb SHA256 2565f1e432d61ba7fd55531f969b742daeeb9e04c193d813ab403370dfff35e5
+MISC metadata.xml 349 RMD160 8e5ecd3c757f94fbccafc8120f4c8a04567135b4 SHA1 3ff0251dbb2863c4fbf0913b901bc27ed73a1acd SHA256 fcb983296ee1568339772668bcf236db0a24aabba6c328343d7bdb790978cbb9
diff --git a/sys-boot/grub/grub-1.99.ebuild b/sys-boot/grub/grub-1.99.ebuild
new file mode 100644
index 0000000..81b2545
--- /dev/null
+++ b/sys-boot/grub/grub-1.99.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# FIXME: somehow depend on python-2 only; using python eclass maybe?
+# NOTE: good idea would be to move grub-2 to new package called grub2
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+ EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+ LIVE_ECLASS="autotools bzr"
+ SRC_URI=""
+else
+ MY_P=${P/_/\~}
+ SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+ mirror://gentoo/${MY_P}.tar.xz"
+ S=${WORKDIR}/${MY_P}
+fi
+
+inherit mount-boot eutils flag-o-matic toolchain-funcs ${LIVE_ECLASS}
+unset LIVE_ECLASS
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="custom-cflags debug device-mapper static sdl truetype"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r5
+ dev-libs/lzo
+ debug? (
+ sdl? ( media-libs/libsdl )
+ )
+ device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+ truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
+DEPEND="${RDEPEND}
+ >=dev-lang/python-2.5.2
+"
+if [[ ${PV} == "9999" ]]; then
+ DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
+else
+ DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub/*/*.mod"
+QA_EXECSTACK="
+ sbin/grub-probe
+ sbin/grub-setup
+ sbin/grub-mkdevicemap
+ bin/grub-script-check
+ bin/grub-fstest
+"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+src_prepare() {
+ epatch_user
+
+ # autogen.sh does more than just run autotools
+ if [[ ${PV} == "9999" ]] ; then
+ sed -i -e '/^autoreconf/s:^:e:' autogen.sh || die
+ (. ./autogen.sh) || die
+ fi
+}
+
+src_configure() {
+ use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
+ use static && append-ldflags -static
+
+ econf \
+ --disable-werror \
+ --sbindir=/sbin \
+ --bindir=/bin \
+ --libdir=/$(get_libdir) \
+ --disable-efiemu \
+ $(use_enable device-mapper) \
+ $(use_enable truetype grub-mkfont) \
+ $(use_enable debug mm-debug) \
+ $(use sdl && use_enable debug grub-emu-sdl) \
+ $(use_enable debug grub-emu-usb)
+}
+
+src_install() {
+ default
+
+ insinto /etc/default
+ newins "${FILESDIR}"/defaults grub
+ cat <<-EOF >> "${D}"/lib*/grub/grub-mkconfig_lib
+ GRUB_DISTRIBUTOR="Gentoo"
+EOF
+}
+
+setup_boot_dir() {
+ local dir=$1
+
+ if [[ ! -e ${dir}/grub.cfg ]]; then
+ # display the link to guide if user didn't set up anything yet.
+ elog "For informations how to configure grub-2 please reffer to guide:"
+ # FIXME: we don't have any guide yet!
+ # Lets just use archlinux wiki until we have some.
+ elog " https://wiki.archlinux.org/index.php/GRUB2"
+ fi
+
+ if [[ ! -e ${dir}/grub.cfg && -e ${dir}/menu.lst ]] ; then
+ # This is first grub2 install and we have old configuraton for
+ # grub1 around. Lets try to generate grub.cfg from it so user
+ # does not loose any stuff when rebooting.
+ # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
+ einfo "Running: grub-menulst2cfg '${dir}/menu.lst' '${dir}/grub.cfg'"
+ grub-menulst2cfg "${dir}/menu.lst" "${dir}/grub.cfg" || \
+ ewarn "Running grub-menulst2cfg failed!"
+
+ einfo "Even if we just created configuration for your grub-2 using old"
+ einfo "grub-1 configuration file you should migrate to use new style"
+ einfo "configuration in '${ROOT}/etc/grub.d'."
+ else
+ # we need to refresh the grub.cfg everytime just to play it safe
+ einfo "Running: grub-mkconfig -o '${dir}/grub.cfg'"
+ grub-mkconfig -o "${dir}/grub.cfg" || \
+ ewarn "Running grub-mkconfig failed! Check your configuration files!"
+ fi
+
+ elog "Remember to run \"grub-mkconfig -o '${dir}/grub.cfg'\" every time"
+ elog "you update the configuration files."
+}
+
+pkg_postinst() {
+ mount-boot_mount_boot_partition
+
+ setup_boot_dir "${ROOT}"boot/grub
+
+ # needs to be called after we call setup_boot_dir
+ mount-boot_pkg_postinst
+}
diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild
new file mode 100644
index 0000000..913e512
--- /dev/null
+++ b/sys-boot/grub/grub-9999.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# FIXME: somehow depend on python-2 only; using python eclass maybe?
+# NOTE: good idea would be to move grub-2 to new package called grub2
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+ EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+ LIVE_ECLASS="autotools bzr"
+ SRC_URI=""
+else
+ MY_P=${P/_/\~}
+ SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+ mirror://gentoo/${MY_P}.tar.xz"
+ S=${WORKDIR}/${MY_P}
+fi
+
+inherit mount-boot eutils flag-o-matic toolchain-funcs ${LIVE_ECLASS}
+unset LIVE_ECLASS
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS=""
+IUSE="custom-cflags debug device-mapper static sdl truetype"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r5
+ dev-libs/lzo
+ debug? (
+ sdl? ( media-libs/libsdl )
+ )
+ device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+ truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
+DEPEND="${RDEPEND}
+ >=dev-lang/python-2.5.2
+"
+if [[ ${PV} == "9999" ]]; then
+ DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
+else
+ DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub/*/*.mod"
+QA_EXECSTACK="
+ sbin/grub-probe
+ sbin/grub-setup
+ sbin/grub-mkdevicemap
+ bin/grub-script-check
+ bin/grub-fstest
+"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+src_prepare() {
+ epatch_user
+
+ # autogen.sh does more than just run autotools
+ if [[ ${PV} == "9999" ]] ; then
+ sed -i -e '/^autoreconf/s:^:e:' autogen.sh || die
+ (. ./autogen.sh) || die
+ fi
+}
+
+src_configure() {
+ use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
+ use static && append-ldflags -static
+
+ econf \
+ --disable-werror \
+ --sbindir=/sbin \
+ --bindir=/bin \
+ --libdir=/$(get_libdir) \
+ --disable-efiemu \
+ $(use_enable device-mapper) \
+ $(use_enable truetype grub-mkfont) \
+ $(use_enable debug mm-debug) \
+ $(use sdl && use_enable debug grub-emu-sdl) \
+ $(use_enable debug grub-emu-usb)
+}
+
+src_install() {
+ default
+
+ insinto /etc/default
+ newins "${FILESDIR}"/defaults grub
+ cat <<-EOF >> "${D}"/lib*/grub/grub-mkconfig_lib
+ GRUB_DISTRIBUTOR="Gentoo"
+EOF
+}
+
+setup_boot_dir() {
+ local dir=$1
+
+ if [[ ! -e ${dir}/grub.cfg ]]; then
+ # display the link to guide if user didn't set up anything yet.
+ elog "For informations how to configure grub-2 please reffer to guide:"
+ # FIXME: we don't have any guide yet!
+ # Lets just use archlinux wiki until we have some.
+ elog " https://wiki.archlinux.org/index.php/GRUB2"
+ fi
+
+ if [[ ! -e ${dir}/grub.cfg && -e ${dir}/menu.lst ]] ; then
+ # This is first grub2 install and we have old configuraton for
+ # grub1 around. Lets try to generate grub.cfg from it so user
+ # does not loose any stuff when rebooting.
+ # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
+ einfo "Running: grub-menulst2cfg '${dir}/menu.lst' '${dir}/grub.cfg'"
+ grub-menulst2cfg "${dir}/menu.lst" "${dir}/grub.cfg" || \
+ ewarn "Running grub-menulst2cfg failed!"
+
+ einfo "Even if we just created configuration for your grub-2 using old"
+ einfo "grub-1 configuration file you should migrate to use new style"
+ einfo "configuration in '${ROOT}/etc/grub.d'."
+ else
+ # we need to refresh the grub.cfg everytime just to play it safe
+ einfo "Running: grub-mkconfig -o '${dir}/grub.cfg'"
+ grub-mkconfig -o "${dir}/grub.cfg" || \
+ ewarn "Running grub-mkconfig failed! Check your configuration files!"
+ fi
+
+ elog "Remember to run \"grub-mkconfig -o '${dir}/grub.cfg'\" every time"
+ elog "you update the configuration files."
+}
+
+pkg_postinst() {
+ mount-boot_mount_boot_partition
+
+ setup_boot_dir "${ROOT}"boot/grub
+
+ # needs to be called after we call setup_boot_dir
+ mount-boot_pkg_postinst
+}
diff --git a/sys-boot/grub/metadata.xml b/sys-boot/grub/metadata.xml
new file mode 100644
index 0000000..a05c330
--- /dev/null
+++ b/sys-boot/grub/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+<use>
+ <flag name='device-mapper'>Enable support for <pkg>sys-fs/device-mapper</pkg></flag>
+ <flag name='multislot'>Allow grub1 and grub2 to be installed simultaneously</flag>
+</use>
+</pkgmetadata>