Contents of /smage/trunk/core/grub/grub-2.00-r1.smage2
Parent Directory | Revision Log
Revision 3928 -
(show annotations)
(download)
Tue Jul 24 09:59:06 2012 UTC (12 years, 2 months ago) by niro
File size: 3674 byte(s)
Tue Jul 24 09:59:06 2012 UTC (12 years, 2 months ago) by niro
File size: 3674 byte(s)
-ALX_ONLY_KEEP -> ALX_PKG_KEEP
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="2.00" |
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-libs/ncurses-5.9 |
13 | >= sys-libs/zlib-1.2.5 |
14 | >= media-libs/freetype-2.4" |
15 | |
16 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
17 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
18 | |
19 | ALX_PKG_KEEP="boot/grub etc/conf.d etc/grub.d usr/sbin |
20 | usr/share/grub |
21 | usr/bin/grub-mkimage |
22 | usr/bin/grub-editenv |
23 | usr/bin/grub-mkrelpath |
24 | usr/bin/grub-script-check |
25 | usr/$(mlibdir)/grub/grub-mkconfig_lib |
26 | usr/$(mlibdir)/grub/update-grub_lib |
27 | usr/$(mlibdir)/grub/i386-pc" |
28 | |
29 | sminclude mtools alx-split |
30 | |
31 | SRC_URI=( |
32 | gnu://${PNAME}/${SRCFILE} |
33 | mirror://${PNAME}/${SRCFILE} |
34 | mirror://${PNAME}/${PNAME}-${PVER}-confd.patch |
35 | mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch |
36 | mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch |
37 | mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch |
38 | ) |
39 | |
40 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
41 | |
42 | # grub doesn't like CFLAG optimation, |
43 | # and do you really want that at your bootloader ?? |
44 | unset CFLAGS |
45 | unset CXXFLAGS |
46 | |
47 | src_prepare() |
48 | { |
49 | munpack ${SRCFILE} || die |
50 | cd ${SRCDIR} |
51 | |
52 | # use /etc/conf.d/grub instead of /etc/default/grub |
53 | mpatch ${PNAME}-${PVER}-confd.patch || die |
54 | # cosmetic fixes |
55 | mpatch ${PNAME}-${PVER}-cosmetic.patch || die |
56 | # fix ftbfs with newer glibc (>= 2.16) |
57 | mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die |
58 | |
59 | # fixes some issues with busybox |
60 | mpatch ${PNAME}-${PVER}-busybox.patch || die |
61 | } |
62 | |
63 | src_compile() |
64 | { |
65 | cd ${SRCDIR} |
66 | |
67 | mconfigure --disable-efiemu --disable-werror --disable-nls || die |
68 | mmake || die |
69 | } |
70 | |
71 | alx_generic_src_install() |
72 | { |
73 | cd ${SRCDIR} |
74 | |
75 | mmake DESTDIR=${BINDIR} install || die |
76 | |
77 | # set distribution |
78 | echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/$(mlibdir)/grub/grub-mkconfig_lib || die |
79 | |
80 | # install only grub dir, no default config |
81 | minstalldir /boot/grub || die |
82 | |
83 | # docs |
84 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
85 | |
86 | # setup a proper grub default conf |
87 | minstalldir /etc/conf.d || die |
88 | mcinjectfile grub.confd /etc/conf.d/grub || die |
89 | |
90 | # use custom creation scripts and delete the provided ones |
91 | local i |
92 | for i in ${BINDIR}/etc/grub.d/10_linux \ |
93 | ${BINDIR}/etc/grub.d/20_linux_xen \ |
94 | ${BINDIR}/etc/grub.d/30_os-prober \ |
95 | ${BINDIR}/etc/grub.d/40_custom \ |
96 | ${BINDIR}/etc/grub.d/41_custom \ |
97 | ${BINDIR}/etc/grub.d/README |
98 | do |
99 | if [[ -f ${i} ]] |
100 | then |
101 | rm ${i} || die |
102 | fi |
103 | done |
104 | mcinjectexec 05_alx_header /etc/grub.d/ || die |
105 | mcinjectexec 10_alx /etc/grub.d/ || die |
106 | } |
107 | |
108 | preinstall() |
109 | { |
110 | mount /boot &> /dev/null |
111 | |
112 | add_conf_prot_mask /etc/grub.d |
113 | add_conf_prot_ignore /etc/conf.d/grub |
114 | } |
115 | |
116 | postinstall() |
117 | { |
118 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
119 | |
120 | # creates some essential links |
121 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
122 | |
123 | # clean up old helpers, which are now consolidated to the '10_alx' script |
124 | local i |
125 | for i in 30_alx_hwdetect 40_alx_reset |
126 | do |
127 | if [ -f ${MROOT}/etc/grub/${i} ] |
128 | then |
129 | rm ${MROOT}/etc/grub/${i} |
130 | fi |
131 | done |
132 | |
133 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
134 | then |
135 | # create a device.map |
136 | if [[ ! -f /boot/grub/device.map ]] |
137 | then |
138 | grub-mkdevicemap |
139 | fi |
140 | |
141 | # needed by grub-mkconfig on the first run |
142 | if [[ ! -f /boot/grub/video.lst ]] |
143 | then |
144 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
145 | fi |
146 | |
147 | # update grub.cfg |
148 | grub-mkconfig -o /boot/grub/grub.cfg |
149 | |
150 | # install bootloader to disk |
151 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
152 | local bootdisk |
153 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
154 | |
155 | # Generate core.img, but don't let it be installed in boot sector |
156 | grub-install --no-floppy "${bootdisk}" |
157 | fi |
158 | } |