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