Magellan Linux

Contents of /branches/R11-unstable/core/grub/grub-2.02-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32187 - (show annotations) (download)
Mon Apr 29 11:51:16 2019 UTC (5 years ago) by niro
File size: 3296 byte(s)
-release branches/R11-unstable
1 # $Id$
2
3 PNAME="grub"
4 PVER="2.02"
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-dev/gettext-0.19
15 >= sys-libs/zlib-1.2.5
16 >= media-libs/freetype-2.5
17 >= app-arch/xz-utils-5
18 >= sys-apps/os-prober-1.56
19 >= sys-fs/device-mapper-2.02"
20
21 SRCFILE="${PNAME}-${PVER}.tar.gz"
22 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
23
24 sminclude mtools
25
26 # grub.confd revision
27 CONF_REV=1.4
28
29 SRC_URI=(
30 gnu://${PNAME}/${SRCFILE}
31 mirror://${PNAME}/${SRCFILE}
32 mirror://${PNAME}/${PNAME}-2.02-confd-2.patch
33 mirror://${PNAME}/${PNAME}-2.02-cosmetic.patch
34 mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch
35 mirror://${PNAME}/grub.confd-${CONF_REV}
36 )
37
38 UP2DATE="updatecmd_gnu ${PNAME} gz"
39
40 # grub doesn't like CFLAG optimation,
41 # and do you really want that at your bootloader ??
42 unset CFLAGS
43 unset CXXFLAGS
44
45 src_prepare()
46 {
47 munpack ${SRCFILE} || die
48 cd ${SRCDIR}
49
50 # use /etc/conf.d/grub instead of /etc/default/grub
51 mpatch ${PNAME}-2.02-confd-2.patch || die
52 # cosmetic fixes
53 mpatch ${PNAME}-2.02-cosmetic.patch || die
54 # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set
55 mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch
56 }
57
58 src_compile()
59 {
60 cd ${SRCDIR}
61
62 mconfigure --disable-efiemu --disable-werror || die
63 mmake || die
64 }
65
66 src_install()
67 {
68 cd ${SRCDIR}
69
70 mmake DESTDIR=${BINDIR} install || die
71
72 # not required by pretty name patch anymore
73 # set distribution
74 #echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
75
76 # setup a proper grub default conf
77 minstallconf grub.confd-${CONF_REV} grub || die
78
79 # enable a splash screen by default
80 sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die
81
82 # needed dir
83 minstalldir /boot/grub || die
84
85 # remove debugging related files
86 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
87 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
88 mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
89 mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
90 mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
91
92 # docs
93 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
94 }
95
96 preinstall()
97 {
98 mount /boot &> /dev/null
99 }
100
101 postinstall()
102 {
103 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
104
105 # creates some essential links
106 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
107
108 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
109 then
110 # create a device.map
111 if [[ ! -f /boot/grub/device.map ]]
112 then
113 if [[ -x $(type -P grub-mkdevicemap) ]]
114 then
115 grub-mkdevicemap
116 fi
117 fi
118
119 # needed by grub-mkconfig on the first run
120 if [[ ! -f /boot/grub/video.lst ]]
121 then
122 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
123 fi
124
125 # update grub.cfg
126 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
127
128 # install bootloader to disk
129 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
130 local bootdisk
131 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
132
133 # Generate core.img, but don't let it be installed in boot sector
134 grub-install --no-floppy "${bootdisk}"
135 fi
136 }