Contents of /smage/trunk/core/grub/grub-1.99-r4.smage2
Parent Directory | Revision Log
Revision 3255 -
(show annotations)
(download)
Thu Sep 22 08:53:10 2011 UTC (12 years, 8 months ago) by niro
File size: 3528 byte(s)
Thu Sep 22 08:53:10 2011 UTC (12 years, 8 months ago) by niro
File size: 3528 byte(s)
-and do not track deprecated targets
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="1.99" |
5 | PBUILD="r4" |
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 | ALX_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 alx-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 | alx_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="ALX Thinclient"' >> ${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_alx_header /etc/grub.d/ || die |
109 | mcinjectexec 10_alx /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 | # clean up old helpers, which are now consolidated to the '10_alx' script |
128 | local i |
129 | for i in 30_alx_hwdetect 40_alx_reset |
130 | do |
131 | if [ -f ${MROOT}/etc/grub/${i} ] |
132 | then |
133 | rm ${MROOT}/etc/grub/${i} |
134 | fi |
135 | done |
136 | |
137 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
138 | then |
139 | # create a device.map |
140 | if [[ ! -f /boot/grub/device.map ]] |
141 | then |
142 | grub-mkdevicemap |
143 | fi |
144 | |
145 | # needed by grub-mkconfig on the first run |
146 | if [[ ! -f /boot/grub/video.lst ]] |
147 | then |
148 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
149 | fi |
150 | |
151 | # update grub.cfg |
152 | grub-mkconfig -o /boot/grub/grub.cfg |
153 | |
154 | # install bootloader to disk |
155 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
156 | local bootdisk |
157 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
158 | |
159 | # Generate core.img, but don't let it be installed in boot sector |
160 | grub-install --no-floppy "${bootdisk}" |
161 | fi |
162 | } |