annotate sys-boot/grub/grub-0.97-r8.ebuild @ 93:93ed2382f27c

forgot to re-gen manifest
author holger@hoho.dyndns.org
date Sun, 28 Dec 2008 13:26:50 +0100
parents 6915f1f9ea05
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
1 # Copyright 1999-2008 Gentoo Foundation
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
2 # Distributed under the terms of the GNU General Public License v2
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
3 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r8.ebuild,v 1.1 2008/11/06 01:28:56 robbat2 Exp $
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
4
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
5 # XXX: we need to review menu.lst vs grub.conf handling. We've been converting
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
6 # all systems to grub.conf (and symlinking menu.lst to grub.conf), but
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
7 # we never updated any of the source code (it still all wants menu.lst),
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
8 # and there is no indication that upstream is making the transition.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
9
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
10 inherit mount-boot eutils flag-o-matic toolchain-funcs autotools
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
11
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
12 PATCHVER="1.8" # Should match the revision ideally
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
13 DESCRIPTION="GNU GRUB Legacy boot loader"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
14 HOMEPAGE="http://www.gnu.org/software/grub/"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
15 SRC_URI="mirror://gentoo/${P}.tar.gz
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
16 ftp://alpha.gnu.org/gnu/${PN}/${P}.tar.gz
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
17 mirror://gentoo/splash.xpm.gz
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
18 mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
19
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
20 LICENSE="GPL-2"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
21 SLOT="0"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
22 KEYWORDS="~amd64 ~x86 ~x86-fbsd"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
23 IUSE="custom-cflags ncurses netboot static"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
24
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
25 DEPEND="ncurses? (
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
26 >=sys-libs/ncurses-5.2-r5
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
27 amd64? ( app-emulation/emul-linux-x86-baselibs )
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
28 )"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
29 PROVIDE="virtual/bootloader"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
30
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
31 src_unpack() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
32 unpack ${A}
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
33 cd "${S}"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
34
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
35 # patch breaks booting for some people #111885
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
36 rm "${WORKDIR}"/patch/400_*
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
37
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
38 # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
39 # discovered in bug 160801. We can change this, however, using larger values
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
40 # for this variable means that Grub needs more memory to run and boot. For a
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
41 # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
42 # value in make.conf, it is possible to make kernels ~16Mb in size, but it
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
43 # needs the kitchen sink built-in.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
44 local t="custom"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
45 if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
46 case $(tc-arch) in
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
47 amd64) GRUB_MAX_KERNEL_SIZE=7 ;;
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
48 x86) GRUB_MAX_KERNEL_SIZE=3 ;;
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
49 esac
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
50 t="default"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
51 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
52 einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
53
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
54 sed -i \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
55 -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
56 "${S}"/grub/asmstub.c \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
57 || die "Failed to hack memory size"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
58
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
59 if [[ -n ${PATCHVER} ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
60 EPATCH_SUFFIX="patch"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
61 epatch "${WORKDIR}"/patch
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
62 epatch "${FILESDIR}/grub-0.97-ext4extents.patch"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
63 eautoreconf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
64 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
65 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
66
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
67 src_compile() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
68 filter-flags -fPIE #168834
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
69
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
70 use amd64 && multilib_toolchain_setup x86
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
71
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
72 unset BLOCK_SIZE #73499
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
73
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
74 ### i686-specific code in the boot loader is a bad idea; disabling to ensure
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
75 ### at least some compatibility if the hard drive is moved to an older or
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
76 ### incompatible system.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
77
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
78 # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
79 # but the objcopy's (faulty) test fails if -fstack-protector is default.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
80 # create a cache telling configure that objcopy is ok, and add -C to econf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
81 # to make use of the cache.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
82 #
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
83 # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
84 # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
85 # -fno-stack-protector detected by configure, removed from netboot's emake.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
86 use custom-cflags || unset CFLAGS
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
87
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
88 export grub_cv_prog_objcopy_absolute=yes #79734
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
89 use static && append-ldflags -static
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
90
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
91 # Per bug 216625, the emul packages do not provide .a libs for performing
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
92 # suitable static linking
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
93 if use amd64 && use static ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
94 if [ -z "${GRUB_STATIC_PACKAGE_BUILDING}" ]; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
95 die "You must use the grub-static package if you want a static Grub on amd64!"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
96 else
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
97 eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
98 eerror "is specifically intended for building the tarballs for the"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
99 eerror "grub-static package via USE='static -ncurses'."
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
100 eerror "All bets are now off."
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
101 ebeep 10
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
102 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
103 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
104
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
105 # build the net-bootable grub first, but only if "netboot" is set
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
106 if use netboot ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
107 econf \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
108 --libdir=/lib \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
109 --datadir=/usr/lib/grub \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
110 --exec-prefix=/ \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
111 --disable-auto-linux-mem-opt \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
112 --enable-diskless \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
113 --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
114 --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
115 --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
116 --enable-{tulip,via-rhine,w89c840} || die "netboot econf failed"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
117
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
118 emake w89c840_o_CFLAGS="-O" || die "making netboot stuff"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
119
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
120 mv -f stage2/{nbgrub,pxegrub} "${S}"/
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
121 mv -f stage2/stage2 stage2/stage2.netboot
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
122
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
123 make clean || die "make clean failed"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
124 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
125
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
126 # Now build the regular grub
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
127 # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
128 econf \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
129 --libdir=/lib \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
130 --datadir=/usr/lib/grub \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
131 --exec-prefix=/ \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
132 --disable-auto-linux-mem-opt \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
133 $(use_with ncurses curses) \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
134 || die "econf failed"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
135
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
136 # sanity check due to common failure
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
137 use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
138
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
139 emake || die "making regular stuff"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
140 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
141
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
142 src_test() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
143 # non-default block size also give false pass/fails.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
144 unset BLOCK_SIZE
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
145 make check || die "make check failed"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
146 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
147
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
148 src_install() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
149 emake DESTDIR="${D}" install || die
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
150 if use netboot ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
151 exeinto /usr/lib/grub/${CHOST}
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
152 doexe nbgrub pxegrub stage2/stage2.netboot || die "netboot install"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
153 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
154
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
155 dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
156 newdoc docs/menu.lst grub.conf.sample
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
157 dodoc "${FILESDIR}"/grub.conf.gentoo
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
158 prepalldocs
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
159
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
160 [ -n "${GRUB_STATIC_PACKAGE_BUILDING}" ] && \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
161 mv \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
162 "${D}"/usr/share/doc/${PF} \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
163 "${D}"/usr/share/doc/grub-static-${PF/grub-}
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
164
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
165 insinto /usr/share/grub
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
166 doins "${DISTDIR}"/splash.xpm.gz
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
167 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
168
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
169 setup_boot_dir() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
170 local boot_dir=$1
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
171 local dir=${boot_dir}
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
172
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
173 [[ ! -e ${dir} ]] && die "${dir} does not exist!"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
174 [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
175 dir="${dir}/grub"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
176 if [[ ! -e ${dir} ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
177 mkdir "${dir}" || die "${dir} does not exist!"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
178 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
179
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
180 # change menu.lst to grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
181 if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
182 mv -f "${dir}"/menu.lst "${dir}"/grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
183 ewarn
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
184 ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
185 ewarn
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
186 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
187
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
188 if [[ ! -e ${dir}/menu.lst ]]; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
189 einfo "Linking from new grub.conf name to menu.lst"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
190 ln -snf grub.conf "${dir}"/menu.lst
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
191 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
192
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
193 if [[ -e ${dir}/stage2 ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
194 mv "${dir}"/stage2{,.old}
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
195 ewarn "*** IMPORTANT NOTE: you must run grub and install"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
196 ewarn "the new version's stage1 to your MBR. Until you do,"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
197 ewarn "stage1 and stage2 will still be the old version, but"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
198 ewarn "later stages will be the new version, which could"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
199 ewarn "cause problems such as an unbootable system."
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
200 ewarn "This means you must use either grub-install or perform"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
201 ewarn "root/setup manually! For more help, see the handbook:"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
202 ewarn "http://www.gentoo.org/doc/en/handbook/handbook-${ARCH}.xml?part=1&chap=10#grub-install-auto"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
203 ebeep
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
204 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
205
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
206 einfo "Copying files from /lib/grub, /usr/lib/grub and /usr/share/grub to ${dir}"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
207 for x in \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
208 "${ROOT}"/lib*/grub/*/* \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
209 "${ROOT}"/usr/lib*/grub/*/* \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
210 "${ROOT}"/usr/share/grub/* ; do
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
211 [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
212 done
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
213
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
214 if [[ ! -e ${dir}/grub.conf ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
215 s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
216 [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
217 [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
218 [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
219 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
220
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
221 # Per bug 218599, we support grub.conf.install for users that want to run a
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
222 # specific set of Grub setup commands rather than the default ones.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
223 grub_config=${dir}/grub.conf.install
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
224 [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
225 if [[ -e ${grub_config} ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
226 egrep \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
227 -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
228 "${grub_config}" | \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
229 /sbin/grub --batch \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
230 --device-map="${dir}"/device.map \
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
231 > /dev/null
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
232 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
233
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
234 # the grub default commands silently piss themselves if
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
235 # the default file does not exist ahead of time
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
236 if [[ ! -e ${dir}/default ]] ; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
237 grub-set-default --root-directory="${boot_dir}" default
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
238 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
239 einfo "Grub has been installed to ${boot_dir} successfully."
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
240 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
241
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
242 pkg_postinst() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
243 if [[ -n ${DONT_MOUNT_BOOT} ]]; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
244 elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
245 elog "the following instructions for your /boot!"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
246 elog "Neglecting to do so may cause your system to fail to boot!"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
247 elog
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
248 else
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
249 setup_boot_dir "${ROOT}"/boot
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
250 # Trailing output because if this is run from pkg_postinst, it gets mixed into
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
251 # the other output.
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
252 einfo ""
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
253 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
254 elog "To interactively install grub files to another device such as a USB"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
255 elog "stick, just run the following and specify the directory as prompted:"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
256 elog " emerge --config =${PF}"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
257 elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
258 elog "grub where to install in a non-interactive way."
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
259
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
260 }
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
261
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
262 pkg_config() {
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
263 local dir
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
264 if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
265 einfo "Enter the directory where you want to setup grub:"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
266 read dir
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
267 else
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
268 dir="${GRUB_ALT_INSTALLDIR}"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
269 fi
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
270 setup_boot_dir "${dir}"
6915f1f9ea05 patches to grub to boot with ext4
holger@hoho.dyndns.org
parents:
diff changeset
271 }