Contents of /smage/trunk/core/grub/grub-2.00-r7.smage2
Parent Directory | Revision Log
Revision 5414 -
(show annotations)
(download)
Tue Jan 21 09:39:44 2014 UTC (10 years, 4 months ago) by niro
File size: 4692 byte(s)
Tue Jan 21 09:39:44 2014 UTC (10 years, 4 months ago) by niro
File size: 4692 byte(s)
-do not ignore /etc/conf.d/grub, always update this file, override can be done via /etc/conf.d/grub.d and the includedir() patch
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="2.00" |
5 | PBUILD="r7" |
6 | |
7 | PCAT="sys-apps" |
8 | |
9 | DESCRIPTION="GNU GRUB2 boot loader." |
10 | HOMEPAGE="http://www.gnu.org/software/grub/" |
11 | |
12 | DEPEND=">= sys-libs/ncurses-5.9 |
13 | >= sys-libs/zlib-1.2.5 |
14 | >= media-libs/freetype-2.5 |
15 | >= sys-fs/device-mapper-2.02" |
16 | |
17 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
18 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
19 | |
20 | ALX_PKG_KEEP="boot/grub |
21 | etc/conf.d |
22 | etc/grub.d |
23 | usr/sbin/grub-bios-setup |
24 | usr/sbin/grub-install |
25 | usr/sbin/grub-mkconfig |
26 | usr/sbin/grub-probe |
27 | usr/sbin/grub-reboot |
28 | usr/sbin/grub-set-default |
29 | usr/bin/grub-mkimage |
30 | usr/bin/grub-editenv |
31 | usr/bin/grub-mkrelpath |
32 | usr/bin/grub-script-check |
33 | usr/share/grub/grub-mkconfig_lib |
34 | usr/$(mlibdir)/grub/i386-pc" |
35 | sminclude mtools alx-split |
36 | |
37 | SRC_URI=( |
38 | gnu://${PNAME}/${SRCFILE} |
39 | mirror://${PNAME}/${SRCFILE} |
40 | mirror://${PNAME}/${PNAME}-${PVER}-confd.patch |
41 | mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch |
42 | mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch |
43 | mirror://${PNAME}/${PNAME}-${PVER}-freetype25.patch |
44 | mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch |
45 | mirror://${PNAME}/${PNAME}-${PVER}-alx-add-includedir-function.patch |
46 | ) |
47 | |
48 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
49 | |
50 | # grub doesn't like CFLAG optimation, |
51 | # and do you really want that at your bootloader ?? |
52 | unset CFLAGS |
53 | unset CXXFLAGS |
54 | |
55 | src_prepare() |
56 | { |
57 | munpack ${SRCFILE} || die |
58 | cd ${SRCDIR} |
59 | |
60 | # use /etc/conf.d/grub instead of /etc/default/grub |
61 | mpatch ${PNAME}-${PVER}-confd.patch || die |
62 | # cosmetic fixes |
63 | mpatch ${PNAME}-${PVER}-cosmetic.patch || die |
64 | # fix ftbfs with newer glibc (>= 2.16) |
65 | mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die |
66 | # fix ftbfs with newer freetype (>= 2.5" |
67 | mpatch ${PNAME}-${PVER}-freetype25.patch || die |
68 | |
69 | # fixes some issues with busybox |
70 | mpatch ${PNAME}-${PVER}-busybox.patch || die |
71 | |
72 | # add includedir() function to grub-mkconfig_lib |
73 | # includedir() includes all grub configuration snippets of given directory |
74 | mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die |
75 | } |
76 | |
77 | src_compile() |
78 | { |
79 | cd ${SRCDIR} |
80 | |
81 | mconfigure --disable-efiemu --disable-werror --disable-nls || die |
82 | mmake || die |
83 | } |
84 | |
85 | alx_generic_src_install() |
86 | { |
87 | cd ${SRCDIR} |
88 | |
89 | mmake DESTDIR=${BINDIR} install || die |
90 | |
91 | # set distribution |
92 | echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die |
93 | |
94 | # install only grub dir, no default config |
95 | minstalldir /boot/grub || die |
96 | |
97 | # remove debugging related files |
98 | rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.module || die |
99 | rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.image || die |
100 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die |
101 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die |
102 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die |
103 | |
104 | # docs |
105 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
106 | |
107 | # setup a proper grub default conf |
108 | minstalldir /etc/conf.d || die |
109 | mcinjectfile grub.confd /etc/conf.d/grub || die |
110 | minstalldir /etc/conf.d/grub.d || die |
111 | mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die |
112 | |
113 | # use custom creation scripts and delete the provided ones |
114 | echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT} |
115 | local i |
116 | for i in ${BINDIR}/etc/grub.d/10_linux \ |
117 | ${BINDIR}/etc/grub.d/20_linux_xen \ |
118 | ${BINDIR}/etc/grub.d/30_os-prober \ |
119 | ${BINDIR}/etc/grub.d/40_custom \ |
120 | ${BINDIR}/etc/grub.d/41_custom \ |
121 | ${BINDIR}/etc/grub.d/README |
122 | do |
123 | if [[ -f ${i} ]] |
124 | then |
125 | rm ${i} || die |
126 | fi |
127 | done |
128 | mcinjectexec 05_alx_header /etc/grub.d/ || die |
129 | mcinjectexec 10_alx /etc/grub.d/ || die |
130 | } |
131 | |
132 | preinstall_grub() |
133 | { |
134 | mount /boot &> /dev/null |
135 | |
136 | add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d |
137 | } |
138 | |
139 | postinstall_grub() |
140 | { |
141 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
142 | |
143 | # creates some essential links |
144 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
145 | |
146 | # clean up old helpers, which are now consolidated to the '10_alx' script |
147 | local i |
148 | for i in 30_alx_hwdetect 40_alx_reset |
149 | do |
150 | if [ -f ${MROOT}/etc/grub/${i} ] |
151 | then |
152 | rm ${MROOT}/etc/grub/${i} |
153 | fi |
154 | done |
155 | |
156 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
157 | then |
158 | # create a device.map |
159 | if [[ ! -f /boot/grub/device.map ]] |
160 | then |
161 | grub-mkdevicemap |
162 | fi |
163 | |
164 | # needed by grub-mkconfig on the first run |
165 | if [[ ! -f /boot/grub/video.lst ]] |
166 | then |
167 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
168 | fi |
169 | |
170 | # update grub.cfg |
171 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg |
172 | |
173 | # install bootloader to disk |
174 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
175 | local bootdisk |
176 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
177 | |
178 | # Generate core.img, but don't let it be installed in boot sector |
179 | grub-install --no-floppy "${bootdisk}" |
180 | fi |
181 | } |