Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14271 - (hide annotations) (download)
Tue Jul 7 14:05:43 2020 UTC (3 years, 11 months ago) by niro
File size: 5638 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 niro 14269 mirror://${PNAME}/${PNAME}-2.04-confd.patch
47 niro 14268 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 niro 14269 mirror://${PNAME}/${PNAME}-2.04-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch
51 niro 14268 )
52    
53     UP2DATE="updatecmd_gnu ${PNAME} gz"
54    
55     # grub doesn't like CFLAG optimation,
56     # and do you really want that at your bootloader ??
57     unset CFLAGS
58     unset CXXFLAGS
59    
60     src_prepare()
61     {
62     munpack ${SRCFILE} || die
63     cd ${SRCDIR}
64    
65     # use /etc/conf.d/grub instead of /etc/default/grub
66 niro 14269 mpatch ${PNAME}-2.04-confd.patch || die
67 niro 14268 # cosmetic fixes
68     mpatch ${PNAME}-2.02-cosmetic.patch || die
69     # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set
70     mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch
71     # grub-mkconfig: fallback to blkid instead of grub probe for unknown root partition types like f2fs
72 niro 14269 mpatch ${PNAME}-2.04-grub-mkconfig-fallback-to-blkid-instead-of-grub-probe-for-unknown-root-partition-types.patch || die
73 niro 14268
74     # add includedir() function to grub-mkconfig_lib
75     # includedir() includes all grub configuration snippets of given directory
76     mpatch ${PNAME}-2.00-alx-add-includedir-function.patch || die
77     }
78    
79     src_compile()
80     {
81     cd ${SRCDIR}
82    
83 niro 14271 # unset all compiler flags
84     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MAKEFLAGS
85    
86     # bios build
87 niro 14268 mconfigure --disable-efiemu --disable-werror --disable-nls || die
88     mmake || die
89     }
90    
91     alx_generic_src_install()
92     {
93     cd ${SRCDIR}
94    
95     mmake DESTDIR=${BINDIR} install || die
96    
97     # not required by pretty name patch anymore
98     # set distribution
99     #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
100    
101     # install only grub dir, no default config
102     minstalldir /boot/grub || die
103    
104     # remove debugging related files
105     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
106     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
107     mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
108     mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
109     mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
110    
111     # docs
112     minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
113    
114     # setup a proper grub default conf
115     minstalldir /etc/conf.d || die
116     mcinjectfile grub.confd /etc/conf.d/grub || die
117     # minstalldir /etc/conf.d/grub.d || die
118     # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
119    
120     # # use custom creation scripts and delete the provided ones
121     # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
122     # local i
123     # for i in ${BINDIR}/etc/grub.d/10_linux \
124     # ${BINDIR}/etc/grub.d/20_linux_xen \
125     # ${BINDIR}/etc/grub.d/30_os-prober \
126     # ${BINDIR}/etc/grub.d/40_custom \
127     # ${BINDIR}/etc/grub.d/41_custom \
128     # ${BINDIR}/etc/grub.d/README
129     # do
130     # if [[ -f ${i} ]]
131     # then
132     # rm ${i} || die
133     # fi
134     # done
135     # mcinjectexec 05_alx_header /etc/grub.d/ || die
136     # mcinjectexec 10_alx /etc/grub.d/ || die
137    
138     # only keep 10_linux script
139     for i in ${BINDIR}/etc/grub.d/20_linux_xen \
140     ${BINDIR}/etc/grub.d/30_os-prober \
141     ${BINDIR}/etc/grub.d/40_custom \
142     ${BINDIR}/etc/grub.d/41_custom \
143     ${BINDIR}/etc/grub.d/README
144     do
145     if [[ -f ${i} ]]
146     then
147     rm ${i} || die
148     fi
149     done
150     }
151    
152     preinstall_grub()
153     {
154     mount /boot &> /dev/null
155    
156     add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
157     }
158    
159     postinstall_grub()
160     {
161     [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
162    
163     # creates some essential links
164     [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
165    
166     # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
167     local i
168     for i in 30_alx_hwdetect 40_alx_reset 10-alx
169     do
170     if [ -f ${MROOT}/etc/grub/${i} ]
171     then
172     rm ${MROOT}/etc/grub/${i}
173     fi
174     done
175     if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
176     then
177     rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
178     fi
179    
180     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
181     then
182     # create a device.map
183     if [[ ! -f /boot/grub/device.map ]]
184     then
185     if [[ -x $(type -P grub-mkdevicemap) ]]
186     then
187     grub-mkdevicemap
188     fi
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     }