Magellan Linux

Contents of /branches/R11-stable/core/grub/grub-2.00-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14772 - (show annotations) (download)
Wed Jan 2 09:23:52 2013 UTC (11 years, 4 months ago) by niro
File size: 2727 byte(s)
-release branches/R11-stable
1 # $Id$
2
3 PNAME="grub"
4 PVER="2.00"
5 PBUILD="r2"
6
7 PCAT="sys-apps"
8
9 DESCRIPTION="GNU GRUB2 boot loader."
10 HOMEPAGE="http://www.gnu.org/software/grub/"
11
12 DEPEND=">= sys-libs/ncurses-5.9
13 >= sys-libs/zlib-1.2.5
14 >= media-libs/freetype-2.4
15 >= app-arch/xz-utils-5
16 >= sys-apps/os-prober-1.56"
17
18 SRCFILE="${PNAME}-${PVER}.tar.gz"
19 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
20
21 sminclude mtools
22
23 # grub.confd revision
24 CONF_REV=1.4
25
26 SRC_URI=(
27 gnu://${PNAME}/${SRCFILE}
28 mirror://${PNAME}/${SRCFILE}
29 mirror://${PNAME}/${PNAME}-${PVER}-confd.patch
30 mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch
31 mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch
32 mirror://${PNAME}/grub.confd-${CONF_REV}
33 )
34
35 UP2DATE="updatecmd_gnu ${PNAME} gz"
36
37 # grub doesn't like CFLAG optimation,
38 # and do you really want that at your bootloader ??
39 unset CFLAGS
40 unset CXXFLAGS
41
42 src_prepare()
43 {
44 munpack ${SRCFILE} || die
45 cd ${SRCDIR}
46
47 # use /etc/conf.d/grub instead of /etc/default/grub
48 mpatch ${PNAME}-${PVER}-confd.patch || die
49 # cosmetic fixes
50 mpatch ${PNAME}-${PVER}-cosmetic.patch || die
51 # fix ftbfs with newer glibc (>= 2.16)
52 mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die
53 }
54
55 src_compile()
56 {
57 cd ${SRCDIR}
58
59 mconfigure --disable-efiemu --disable-werror || die
60 mmake || die
61 }
62
63 src_install()
64 {
65 cd ${SRCDIR}
66
67 mmake DESTDIR=${BINDIR} install || die
68
69 # set distribution
70 echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
71
72 # setup a proper grub default conf
73 minstallconf grub.confd-${CONF_REV} grub || die
74
75 # enable a splash screen by default
76 sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die
77
78 # needed dir
79 minstalldir /boot/grub || die
80
81 # docs
82 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
83 }
84
85 preinstall()
86 {
87 mount /boot &> /dev/null
88 }
89
90 postinstall()
91 {
92 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
93
94 # creates some essential links
95 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
96
97 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
98 then
99 # create a device.map
100 if [[ ! -f /boot/grub/device.map ]]
101 then
102 grub-mkdevicemap
103 fi
104
105 # needed by grub-mkconfig on the first run
106 if [[ ! -f /boot/grub/video.lst ]]
107 then
108 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
109 fi
110
111 # update grub.cfg
112 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
113
114 # install bootloader to disk
115 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
116 local bootdisk
117 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
118
119 # Generate core.img, but don't let it be installed in boot sector
120 grub-install --no-floppy "${bootdisk}"
121 fi
122 }