blob: 1fd2da9cc38957cf2395722789141dfafba45c3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# 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"
[[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~x86"
IUSE="custom-cflags debug device-mapper nls static sdl truetype"
# os-prober: Used on runtime to detect other OSes
# xorriso: Used on runtime for mkrescue
RDEPEND="
app-cdr/xorriso
dev-libs/lzo
sys-boot/os-prober
>=sys-libs/ncurses-5.2-r5
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/ d' autogen.sh || die
(. ./autogen.sh) || die
eautoreconf
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 nls) \
$(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'."
einfo
elog "Remember to run grub-install to install your grub!"
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
}
|