Magellan Linux

Annotation of /smage/trunk/core/grub/grub-2.00-r12.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9051 - (hide annotations) (download)
Mon Jun 13 11:50:31 2016 UTC (7 years, 11 months ago) by niro
File size: 5868 byte(s)
auto added: ver bump to 2.00-r12
1 niro 9048 # $Id$
2    
3     PNAME="grub"
4     PVER="2.00"
5     PBUILD="r12"
6    
7     PCAT="sys-apps"
8    
9     DESCRIPTION="GNU GRUB2 boot loader."
10     HOMEPAGE="http://www.gnu.org/software/grub/"
11    
12     DEPEND=">= sys-apps/mage-release-1
13     >= sys-libs/ncurses-5.9
14     >= sys-libs/zlib-1.2.5
15     >= media-libs/freetype-2.5
16     >= sys-fs/device-mapper-2.02"
17    
18     SDEPEND=">= sys-libs/ncurses-dev-5.9
19     >= sys-libs/zlib-dev-1.2.5
20 niro 9050 >= media-libs/freetype-dev-2.5"
21 niro 9048
22     SRCFILE="${PNAME}-${PVER}.tar.gz"
23     SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
24    
25     ALX_PKG_KEEP="boot/grub
26     etc/conf.d
27     etc/grub.d
28     usr/sbin/grub-bios-setup
29     usr/sbin/grub-install
30     usr/sbin/grub-mkconfig
31     usr/sbin/grub-probe
32     usr/sbin/grub-reboot
33     usr/sbin/grub-set-default
34     usr/bin/grub-mkimage
35     usr/bin/grub-editenv
36     usr/bin/grub-mkrelpath
37     usr/bin/grub-script-check
38     usr/share/grub/grub-mkconfig_lib
39     usr/$(mlibdir)/grub/i386-pc"
40     sminclude mtools alx-split
41    
42     # += to add injection files (alx.sminc)
43     SRC_URI+=(
44     gnu://${PNAME}/${SRCFILE}
45     mirror://${PNAME}/${SRCFILE}
46     mirror://${PNAME}/${PNAME}-${PVER}-confd.patch
47     mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch
48     mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch
49     mirror://${PNAME}/${PNAME}-${PVER}-freetype25.patch
50     mirror://${PNAME}/${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch
51     mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch
52     mirror://${PNAME}/${PNAME}-${PVER}-alx-add-includedir-function.patch
53     mirror://${PNAME}/${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch
54     mirror://${PNAME}/${PNAME}-${PVER}-busybox-linux-install.patch
55     )
56    
57     UP2DATE="updatecmd_gnu ${PNAME} gz"
58    
59     # grub doesn't like CFLAG optimation,
60     # and do you really want that at your bootloader ??
61     unset CFLAGS
62     unset CXXFLAGS
63    
64     src_prepare()
65     {
66     munpack ${SRCFILE} || die
67     cd ${SRCDIR}
68    
69     # use /etc/conf.d/grub instead of /etc/default/grub
70     mpatch ${PNAME}-${PVER}-confd.patch || die
71     # cosmetic fixes
72     mpatch ${PNAME}-${PVER}-cosmetic.patch || die
73     # fix ftbfs with newer glibc (>= 2.16)
74     mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die
75     # fix ftbfs with newer freetype (>= 2.5)
76     mpatch ${PNAME}-${PVER}-freetype25.patch || die
77     # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set
78     mpatch ${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch
79    
80     # fixes some issues with busybox
81     mpatch ${PNAME}-${PVER}-busybox.patch || die
82     mpatch ${PNAME}-${PVER}-busybox-linux-install.patch || die
83    
84     # add includedir() function to grub-mkconfig_lib
85     # includedir() includes all grub configuration snippets of given directory
86     mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die
87     mpatch ${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch || die
88     }
89    
90     src_compile()
91     {
92     cd ${SRCDIR}
93    
94 niro 9051 mconfigure --disable-efiemu --disable-werror || die
95 niro 9048 mmake || die
96     }
97    
98     alx_generic_src_install()
99     {
100     cd ${SRCDIR}
101    
102     mmake DESTDIR=${BINDIR} install || die
103    
104     # not required by pretty name patch anymore
105     # set distribution
106     #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
107    
108     # install only grub dir, no default config
109     minstalldir /boot/grub || die
110    
111     # remove debugging related files
112     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
113     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
114     mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
115     mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
116     mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
117    
118     # docs
119     minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
120    
121     # setup a proper grub default conf
122     minstalldir /etc/conf.d || die
123     mcinjectfile grub.confd /etc/conf.d/grub || die
124     # minstalldir /etc/conf.d/grub.d || die
125     # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
126    
127     # # use custom creation scripts and delete the provided ones
128     # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
129     # local i
130     # for i in ${BINDIR}/etc/grub.d/10_linux \
131     # ${BINDIR}/etc/grub.d/20_linux_xen \
132     # ${BINDIR}/etc/grub.d/30_os-prober \
133     # ${BINDIR}/etc/grub.d/40_custom \
134     # ${BINDIR}/etc/grub.d/41_custom \
135     # ${BINDIR}/etc/grub.d/README
136     # do
137     # if [[ -f ${i} ]]
138     # then
139     # rm ${i} || die
140     # fi
141     # done
142     # mcinjectexec 05_alx_header /etc/grub.d/ || die
143     # mcinjectexec 10_alx /etc/grub.d/ || die
144    
145     # only keep 10_linux script
146     for i in ${BINDIR}/etc/grub.d/20_linux_xen \
147     ${BINDIR}/etc/grub.d/30_os-prober \
148     ${BINDIR}/etc/grub.d/40_custom \
149     ${BINDIR}/etc/grub.d/41_custom \
150     ${BINDIR}/etc/grub.d/README
151     do
152     if [[ -f ${i} ]]
153     then
154     rm ${i} || die
155     fi
156     done
157     }
158    
159     preinstall_grub()
160     {
161     mount /boot &> /dev/null
162    
163     add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
164     }
165    
166     postinstall_grub()
167     {
168     [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
169    
170     # creates some essential links
171     [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
172    
173     # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
174     local i
175     for i in 30_alx_hwdetect 40_alx_reset 10-alx
176     do
177     if [ -f ${MROOT}/etc/grub/${i} ]
178     then
179     rm ${MROOT}/etc/grub/${i}
180     fi
181     done
182     if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
183     then
184     rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
185     fi
186    
187     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
188     then
189     # create a device.map
190     if [[ ! -f /boot/grub/device.map ]]
191     then
192     grub-mkdevicemap
193     fi
194    
195     # needed by grub-mkconfig on the first run
196     if [[ ! -f /boot/grub/video.lst ]]
197     then
198     install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
199     fi
200    
201     # update grub.cfg
202     LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
203    
204     # install bootloader to disk
205     #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
206     local bootdisk
207     bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
208    
209     # Generate core.img, but don't let it be installed in boot sector
210     grub-install --no-floppy "${bootdisk}"
211     fi
212     }