/[gentoo-x86]/sys-boot/grub/grub-9999.ebuild
Gentoo

Diff of /sys-boot/grub/grub-9999.ebuild

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.40 Revision 1.47
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.40 2011/08/31 11:27:51 alexxy Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.47 2011/11/18 00:04:29 vapier Exp $
4 4
5EAPI=4 5EAPI=4
6 6
7if [[ ${PV} == "9999" ]] ; then 7if [[ ${PV} == "9999" ]] ; then
8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/" 8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
9 LIVE_ECLASS="autotools bzr" 9 LIVE_ECLASS="bzr"
10 SRC_URI="" 10 SRC_URI=""
11 DO_AUTORECONF="true"
11else 12else
12 MY_P=${P/_/\~} 13 MY_P=${P/_/\~}
13 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz 14 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
14 mirror://gentoo/${MY_P}.tar.xz" 15 mirror://gentoo/${MY_P}.tar.xz"
16 # Masked until documentation guys consolidate the guide and approve
17 # it for usage.
18 #KEYWORDS="~amd64 ~mips ~x86"
15 S=${WORKDIR}/${MY_P} 19 S=${WORKDIR}/${MY_P}
16fi 20fi
17 21
18inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${LIVE_ECLASS} 22inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
19unset LIVE_ECLASS 23unset LIVE_ECLASS
20 24
21DESCRIPTION="GNU GRUB boot loader" 25DESCRIPTION="GNU GRUB boot loader"
22HOMEPAGE="http://www.gnu.org/software/grub/" 26HOMEPAGE="http://www.gnu.org/software/grub/"
23 27
24LICENSE="GPL-3" 28LICENSE="GPL-3"
25SLOT="2" 29SLOT="2"
26[[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~mips ~x86"
27IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype" 30IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype"
28 31
29GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 multiboot pc qemu qemu-mips loongson" 32GRUB_PLATFORMS=(
30# everywhere: 33 # everywhere:
31# emu 34 emu
32# mips only: 35 # mips only:
33# qemu-mips, loongson 36 qemu-mips yeeloong
34# amd64, x86, ppc, ppc64 37 # amd64, x86, ppc, ppc64:
35# ieee1275 38 ieee1275
36# amd64, x86 39 # amd64, x86:
37# coreboot, multiboot, efi-32, pc, qemu 40 coreboot multiboot efi-32 pc qemu
38# amd64 41 # amd64:
39# efi-64 42 efi-64
40for i in ${GRUB_PLATFORMS}; do 43)
41 IUSE+=" grub_platforms_${i}" 44IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
42done
43unset i
44 45
45# os-prober: Used on runtime to detect other OSes 46# os-prober: Used on runtime to detect other OSes
46# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue 47# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
47RDEPEND=" 48RDEPEND="
48 dev-libs/libisoburn 49 dev-libs/libisoburn
56 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )" 57 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
57DEPEND="${RDEPEND} 58DEPEND="${RDEPEND}
58 >=dev-lang/python-2.5.2 59 >=dev-lang/python-2.5.2
59 sys-devel/flex 60 sys-devel/flex
60 virtual/yacc 61 virtual/yacc
62 sys-apps/texinfo
61" 63"
62if [[ ${PV} == "9999" ]]; then 64if [[ -n ${DO_AUTORECONF} ]] ; then
63 DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man" 65 DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
64else 66else
65 DEPEND+=" app-arch/xz-utils" 67 DEPEND+=" app-arch/xz-utils"
66fi 68fi
67 69
81 bin/grub2-mkfont 83 bin/grub2-mkfont
82 bin/grub2-editenv 84 bin/grub2-editenv
83 bin/grub2-mkimage 85 bin/grub2-mkimage
84" 86"
85 87
88QA_WX_LOAD="
89 lib*/grub2/*/kernel.img
90 lib*/grub2/*/setjmp.mod
91"
92
86grub_run_phase() { 93grub_run_phase() {
87 local phase=$1 94 local phase=$1
88 local platform=$2 95 local platform=$2
89 [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]" 96 [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
90 97
159 epatch \ 166 epatch \
160 "${FILESDIR}/1.99-call_proper_grub_probe.patch" 167 "${FILESDIR}/1.99-call_proper_grub_probe.patch"
161 168
162 epatch_user 169 epatch_user
163 170
171 # fix texinfo file name, as otherwise the grub2.info file will be
172 # useless
173 sed -i \
174 -e '/setfilename/s:grub.info:grub2.info:' \
175 -e 's:(grub):(grub2):' \
176 "${S}"/docs/grub.texi
177
164 # autogen.sh does more than just run autotools 178 # autogen.sh does more than just run autotools
165 if [[ ${PV} == "9999" ]] ; then 179 if [[ -n ${DO_AUTORECONF} ]] ; then
166 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die 180 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
167 (. ./autogen.sh) || die 181 (. ./autogen.sh) || die
168 fi 182 fi
169 183
170 # install into the right dir for eselect #372735 184 # install into the right dir for eselect #372735
172 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \ 186 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
173 util/bash-completion.d/Makefile.in || die 187 util/bash-completion.d/Makefile.in || die
174 188
175 # get enabled platforms 189 # get enabled platforms
176 GRUB_ENABLED_PLATFORMS="" 190 GRUB_ENABLED_PLATFORMS=""
177 for i in ${GRUB_PLATFORMS}; do 191 for i in ${GRUB_PLATFORMS[@]}; do
178 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}" 192 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
179 done 193 done
180 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed" 194 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
181 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}" 195 elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
182} 196}
183 197
184src_configure() { 198src_configure() {
185 local i 199 local i
186 200
205 219
206 for i in ${GRUB_ENABLED_PLATFORMS}; do 220 for i in ${GRUB_ENABLED_PLATFORMS}; do
207 grub_run_phase ${FUNCNAME} ${i} 221 grub_run_phase ${FUNCNAME} ${i}
208 done 222 done
209 223
224 # No need to move the info file with the live ebuild since we
225 # already changed the generated file name during the preparation
226 # phase.
227 if [[ ${PV} != "9999" ]]; then
210 # slot all collisions with grub legacy 228 # slot all collisions with grub legacy
211 mv "${ED}"/usr/share/info/grub.info \ 229 mv "${ED}"/usr/share/info/grub.info \
212 "${ED}"/usr/share/info/grub2.info || die 230 "${ED}"/usr/share/info/grub2.info || die
231 fi
213 232
214 # Do pax marking 233 # Do pax marking
215 local PAX=( 234 local PAX=(
216 "sbin/grub2-probe" 235 "sbin/grub2-probe"
217 "sbin/grub2-setup" 236 "sbin/grub2-setup"
224 "bin/grub2-mkpasswd-pbkdf2" 243 "bin/grub2-mkpasswd-pbkdf2"
225 "bin/grub2-editenv" 244 "bin/grub2-editenv"
226 "bin/grub2-mkimage" 245 "bin/grub2-mkimage"
227 ) 246 )
228 for e in ${PAX[@]}; do 247 for e in ${PAX[@]}; do
229 pax-mark -mpx "${ED}/${e}" 248 pax-mark -mp "${ED}/${e}"
230 done 249 done
231 250
232 # can't be in docs array as we use defualt_src_install in different builddir 251 # can't be in docs array as we use default_src_install in different builddir
233 dodoc AUTHORS ChangeLog NEWS README THANKS TODO 252 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
234 insinto /etc/default 253 insinto /etc/default
235 newins "${FILESDIR}"/grub.default grub 254 newins "${FILESDIR}"/grub.default grub
236 cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib 255 cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
237 GRUB_DISTRIBUTOR="Gentoo" 256 GRUB_DISTRIBUTOR="Gentoo"
238EOF 257EOF
258
259 elog
260 elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
261 elog "then run 'emerge --config =${CATEGORY}/${PF}'."
262
263 # display the link to guide
264 show_doc_url
265}
266
267show_doc_url() {
268 elog
269 elog "For informations how to configure grub-2 please refer to the guide:"
270 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
239} 271}
240 272
241setup_boot_dir() { 273setup_boot_dir() {
242 local dir=$1 274 local dir=$1
275 local use_legacy='n'
243 276
244 # display the link to guide if user didn't set up anything yet. 277 # Make sure target directory exists
245 elog "For informations how to configure grub-2 please reffer to the guide:" 278 mkdir -p "${dir}"
246 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
247 279
248 if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then 280 if [[ -e ${dir/2/}/menu.lst ]] ; then
249 # This is first grub2 install and we have old configuraton for 281 # Legacy config exists, ask user what to do
250 # grub1 around. Lets try to generate grub.cfg from it so user 282 einfo "Found legacy GRUB configuration. Do you want to convert it"
251 # does not loose any stuff when rebooting. 283 einfo "instead of using autoconfig (y/N)?"
252 # NOTE: in long term he still NEEDS to migrate to grub.d stuff. 284 read use_legacy
253 einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
254 grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
255 ewarn "Running grub2-menulst2cfg failed!"
256 285
257 einfo "Even if we just created configuration for your grub2 using old" 286 use_legacy=${use_legacy,,[A-Z]}
258 einfo "grub-legacy configuration file you should migrate to use new style" 287 fi
259 einfo "configuration in '${ROOT}/etc/grub.d'."
260 einfo
261 288
289 if [[ ${use_legacy} == y* ]] ; then
290 grub1_cfg=${dir/2/}/menu.lst
291 grub2_cfg=${dir}/grub.cfg
292
293 # GRUB legacy configuration exists. Use it instead of doing
294 # our normal autoconfigure.
295 #
296
297 einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
298 ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
299 grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
300 eend $?
301
302 ewarn
303 ewarn "Even though the conversion above succeeded, you are STRONGLY"
304 ewarn "URGED to upgrade to the new GRUB2 configuration format."
305
306 # Remind the user about the documentation
307 show_doc_url
262 else 308 else
263 # we need to refresh the grub.cfg everytime just to play it safe 309 # Run GRUB 2 autoconfiguration
310 einfo "Running GRUB 2 autoconfiguration."
264 einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'" 311 ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
265 grub2-mkconfig -o "${dir}/grub.cfg" || \ 312 grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
266 ewarn "Running grub2-mkconfig failed! Check your configuration files!" 313 eend $?
267 fi 314 fi
268 315
269 elog "Remember to run \"grub2-mkconfig -o '${dir}/grub.cfg'\" every time" 316 einfo
270 elog "you update the configuration files!" 317 einfo "Remember to run grub2-install to activate GRUB2 as your default"
271 318 einfo "bootloader."
272 elog "Remember to run grub2-install to install your grub every time"
273 elog "you update this package!"
274} 319}
275 320
276pkg_postinst() { 321pkg_config() {
322 local dir
323
277 mount-boot_mount_boot_partition 324 mount-boot_mount_boot_partition
278 325
279 setup_boot_dir "${ROOT}"boot/grub2 326 einfo "Enter the directory where you want to setup grub2 ('${ROOT}boot/grub2/'):"
327 read dir
280 328
281 # needs to be called after we call setup_boot_dir 329 [[ -z ${dir} ]] && dir="${ROOT}"boot/grub2
330
331 setup_boot_dir "${dir}"
332
282 mount-boot_pkg_postinst 333 mount-boot_pkg_postinst
283} 334}

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20