Magellan Linux

Annotation of /branches/R11-stable/core/grub/grub-2.00-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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