Magellan Linux

Annotation of /smage/trunk/core/grub/grub-2.04-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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