Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14269 - (hide annotations) (download)
Tue Jul 7 13:00:27 2020 UTC (3 years, 10 months ago) by niro
File size: 5545 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     mconfigure --disable-efiemu --disable-werror --disable-nls || die
84     mmake || die
85     }
86    
87     alx_generic_src_install()
88     {
89     cd ${SRCDIR}
90    
91     mmake DESTDIR=${BINDIR} install || die
92    
93     # not required by pretty name patch anymore
94     # set distribution
95     #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
96    
97     # install only grub dir, no default config
98     minstalldir /boot/grub || die
99    
100     # remove debugging related files
101     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
102     mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
103     mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
104     mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
105     mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
106    
107     # docs
108     minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
109    
110     # setup a proper grub default conf
111     minstalldir /etc/conf.d || die
112     mcinjectfile grub.confd /etc/conf.d/grub || die
113     # minstalldir /etc/conf.d/grub.d || die
114     # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
115    
116     # # use custom creation scripts and delete the provided ones
117     # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
118     # local i
119     # for i in ${BINDIR}/etc/grub.d/10_linux \
120     # ${BINDIR}/etc/grub.d/20_linux_xen \
121     # ${BINDIR}/etc/grub.d/30_os-prober \
122     # ${BINDIR}/etc/grub.d/40_custom \
123     # ${BINDIR}/etc/grub.d/41_custom \
124     # ${BINDIR}/etc/grub.d/README
125     # do
126     # if [[ -f ${i} ]]
127     # then
128     # rm ${i} || die
129     # fi
130     # done
131     # mcinjectexec 05_alx_header /etc/grub.d/ || die
132     # mcinjectexec 10_alx /etc/grub.d/ || die
133    
134     # only keep 10_linux script
135     for i in ${BINDIR}/etc/grub.d/20_linux_xen \
136     ${BINDIR}/etc/grub.d/30_os-prober \
137     ${BINDIR}/etc/grub.d/40_custom \
138     ${BINDIR}/etc/grub.d/41_custom \
139     ${BINDIR}/etc/grub.d/README
140     do
141     if [[ -f ${i} ]]
142     then
143     rm ${i} || die
144     fi
145     done
146     }
147    
148     preinstall_grub()
149     {
150     mount /boot &> /dev/null
151    
152     add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
153     }
154    
155     postinstall_grub()
156     {
157     [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
158    
159     # creates some essential links
160     [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
161    
162     # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
163     local i
164     for i in 30_alx_hwdetect 40_alx_reset 10-alx
165     do
166     if [ -f ${MROOT}/etc/grub/${i} ]
167     then
168     rm ${MROOT}/etc/grub/${i}
169     fi
170     done
171     if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
172     then
173     rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
174     fi
175    
176     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
177     then
178     # create a device.map
179     if [[ ! -f /boot/grub/device.map ]]
180     then
181     if [[ -x $(type -P grub-mkdevicemap) ]]
182     then
183     grub-mkdevicemap
184     fi
185     fi
186    
187     # needed by grub-mkconfig on the first run
188     if [[ ! -f /boot/grub/video.lst ]]
189     then
190     install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
191     fi
192    
193     # update grub.cfg
194     LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
195    
196     # install bootloader to disk
197     #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
198     local bootdisk
199     bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
200    
201     # Generate core.img, but don't let it be installed in boot sector
202     grub-install --no-floppy "${bootdisk}"
203     fi
204     }