Magellan Linux

Annotation of /smage/trunk/core/grub/grub-2.02_rc2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9428 - (hide annotations) (download)
Tue Apr 4 11:01:52 2017 UTC (7 years, 1 month ago) by niro
File size: 5825 byte(s)
-fixed missing default/grub references with new confd.patch
1 niro 9423 # $Id$
2    
3     PNAME="grub"
4     PVER="2.02_rc2"
5     PBUILD="r1"
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     >= media-libs/freetype-dev-2.5"
21    
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     http://alpha.gnu.org/gnu/${PNAME}/${SRCFILE}
46     mirror://${PNAME}/${SRCFILE}
47     mirror://${PNAME}/${PNAME}-2.02-confd.patch
48     mirror://${PNAME}/${PNAME}-2.02-cosmetic.patch
49 niro 9425 mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch
50     mirror://${PNAME}/${PNAME}-2.00-alx-add-includedir-function.patch
51 niro 9423 mirror://${PNAME}/${PNAME}-2.02-busybox-linux-install.patch
52 niro 9425 mirror://${PNAME}/${PNAME}-2.00-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch
53 niro 9423 )
54    
55     UP2DATE="updatecmd_gnu ${PNAME} gz"
56    
57     # grub doesn't like CFLAG optimation,
58     # and do you really want that at your bootloader ??
59     unset CFLAGS
60     unset CXXFLAGS
61    
62     src_prepare()
63     {
64     munpack ${SRCFILE} || die
65     cd ${SRCDIR}
66    
67     # use /etc/conf.d/grub instead of /etc/default/grub
68     mpatch ${PNAME}-2.02-confd.patch || die
69     # cosmetic fixes
70     mpatch ${PNAME}-2.02-cosmetic.patch || die
71     # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set
72 niro 9425 mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch
73 niro 9423 # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs
74 niro 9425 mpatch ${PNAME}-2.00-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die
75 niro 9423
76     # fixes some issues with busybox
77     # not required anymore with busybox-1.26 and above, grep -vx|-qx is now supported
78     #mpatch ${PNAME}-${PVER}-busybox.patch || die
79     mpatch ${PNAME}-2.02-busybox-linux-install.patch || die
80    
81     # add includedir() function to grub-mkconfig_lib
82     # includedir() includes all grub configuration snippets of given directory
83 niro 9427 mpatch ${PNAME}-2.00-alx-add-includedir-function.patch || die
84 niro 9423 }
85    
86     src_compile()
87     {
88     cd ${SRCDIR}
89    
90     mconfigure --disable-efiemu --disable-werror --disable-nls || die
91     mmake || die
92     }
93    
94     alx_generic_src_install()
95     {
96     cd ${SRCDIR}
97    
98     mmake DESTDIR=${BINDIR} install || die
99    
100     # not required by pretty name patch anymore
101     # set distribution
102     #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
103    
104     # install only grub dir, no default config
105     minstalldir /boot/grub || die
106    
107     # remove debugging related files
108     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
109     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
110     mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
111     mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
112     mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
113    
114     # docs
115     minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
116    
117     # setup a proper grub default conf
118     minstalldir /etc/conf.d || die
119     mcinjectfile grub.confd /etc/conf.d/grub || die
120     # minstalldir /etc/conf.d/grub.d || die
121     # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
122    
123     # # use custom creation scripts and delete the provided ones
124     # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
125     # local i
126     # for i in ${BINDIR}/etc/grub.d/10_linux \
127     # ${BINDIR}/etc/grub.d/20_linux_xen \
128     # ${BINDIR}/etc/grub.d/30_os-prober \
129     # ${BINDIR}/etc/grub.d/40_custom \
130     # ${BINDIR}/etc/grub.d/41_custom \
131     # ${BINDIR}/etc/grub.d/README
132     # do
133     # if [[ -f ${i} ]]
134     # then
135     # rm ${i} || die
136     # fi
137     # done
138     # mcinjectexec 05_alx_header /etc/grub.d/ || die
139     # mcinjectexec 10_alx /etc/grub.d/ || die
140    
141     # only keep 10_linux script
142     for i in ${BINDIR}/etc/grub.d/20_linux_xen \
143     ${BINDIR}/etc/grub.d/30_os-prober \
144     ${BINDIR}/etc/grub.d/40_custom \
145     ${BINDIR}/etc/grub.d/41_custom \
146     ${BINDIR}/etc/grub.d/README
147     do
148     if [[ -f ${i} ]]
149     then
150     rm ${i} || die
151     fi
152     done
153     }
154    
155     preinstall_grub()
156     {
157     mount /boot &> /dev/null
158    
159     add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
160     }
161    
162     postinstall_grub()
163     {
164     [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
165    
166     # creates some essential links
167     [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
168    
169     # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
170     local i
171     for i in 30_alx_hwdetect 40_alx_reset 10-alx
172     do
173     if [ -f ${MROOT}/etc/grub/${i} ]
174     then
175     rm ${MROOT}/etc/grub/${i}
176     fi
177     done
178     if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
179     then
180     rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
181     fi
182    
183     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
184     then
185     # create a device.map
186     if [[ ! -f /boot/grub/device.map ]]
187     then
188     grub-mkdevicemap
189     fi
190    
191     # needed by grub-mkconfig on the first run
192     if [[ ! -f /boot/grub/video.lst ]]
193     then
194     install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
195     fi
196    
197     # update grub.cfg
198     LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
199    
200     # install bootloader to disk
201     #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
202     local bootdisk
203     bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
204    
205     # Generate core.img, but don't let it be installed in boot sector
206     grub-install --no-floppy "${bootdisk}"
207     fi
208     }