Contents of /smage/trunk/core/grub/grub-1.99-r2.smage2
Parent Directory | Revision Log
Revision 2792 -
(show annotations)
(download)
Mon Aug 29 20:03:18 2011 UTC (13 years ago) by niro
File size: 3680 byte(s)
Mon Aug 29 20:03:18 2011 UTC (13 years ago) by niro
File size: 3680 byte(s)
-merged branch alx-0_6_0 into trunk
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 | 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 | |
29 | REMOVE_DEPRECATED_MAGE_TARGETS=1 |
30 | sminclude mtools alx-split |
31 | |
32 | SRC_URI=( |
33 | gnu://${PNAME}/${SRCFILE} |
34 | mirror://${PNAME}/${SRCFILE} |
35 | mirror://${PNAME}/${PNAME}-${PVER}-confd.patch |
36 | mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch |
37 | ) |
38 | |
39 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
40 | |
41 | # grub doesn't like CFLAG optimation, |
42 | # and do you really want that at your bootloader ?? |
43 | unset CFLAGS |
44 | unset CXXFLAGS |
45 | |
46 | src_prepare() |
47 | { |
48 | munpack ${SRCFILE} || die |
49 | cd ${SRCDIR} |
50 | |
51 | # use /etc/conf.d/grub instead of /etc/default/grub |
52 | mpatch ${PNAME}-${PVER}-confd.patch || die |
53 | |
54 | # fixes some issues with busybox |
55 | mpatch ${PNAME}-${PVER}-busybox.patch || die |
56 | } |
57 | |
58 | src_compile() |
59 | { |
60 | cd ${SRCDIR} |
61 | |
62 | mconfigure \ |
63 | --sbindir=/sbin \ |
64 | --bindir=/bin \ |
65 | --libdir=/$(mlibdir) \ |
66 | --disable-efiemu \ |
67 | --disable-werror \ |
68 | --disable-nls \ |
69 | || die |
70 | |
71 | mmake || die |
72 | } |
73 | |
74 | alx_generic_src_install() |
75 | { |
76 | cd ${SRCDIR} |
77 | |
78 | mmake DESTDIR=${BINDIR} install || die |
79 | |
80 | # fix a missing symlink |
81 | mlink /bin/grub-mkimage /sbin || die |
82 | |
83 | # set distribution |
84 | echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/$(mlibdir)/grub/grub-mkconfig_lib || die |
85 | |
86 | # install only grub dir, no default config |
87 | minstalldir /boot/grub || die |
88 | |
89 | # docs |
90 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
91 | |
92 | # setup a proper grub default conf |
93 | minstalldir /etc/conf.d || die |
94 | mcinjectfile grub.confd /etc/conf.d/grub || die |
95 | |
96 | # user custom creation scripts and delete the provided ones |
97 | local i |
98 | for i in ${BINDIR}/etc/grub.d/10_linux \ |
99 | ${BINDIR}/etc/grub.d/20_linux_xen \ |
100 | ${BINDIR}/etc/grub.d/30_os-prober \ |
101 | ${BINDIR}/etc/grub.d/40_custom \ |
102 | ${BINDIR}/etc/grub.d/41_custom \ |
103 | ${BINDIR}/etc/grub.d/README |
104 | do |
105 | if [[ -f ${i} ]] |
106 | then |
107 | rm ${i} || die |
108 | fi |
109 | done |
110 | mcinjectexec 05_alx_header /etc/grub.d/ || die |
111 | mcinjectexec 10_alx /etc/grub.d/ || die |
112 | mcinjectexec 30_alx_hwdetect /etc/grub.d/ || die |
113 | mcinjectexec 40_alx_reset /etc/grub.d/ || die |
114 | } |
115 | |
116 | preinstall() |
117 | { |
118 | mount /boot &> /dev/null |
119 | |
120 | add_conf_prot_mask /etc/grub.d |
121 | add_conf_prot_ignore /etc/conf.d/grub |
122 | } |
123 | |
124 | postinstall() |
125 | { |
126 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
127 | |
128 | # creates some essential links |
129 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
130 | |
131 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
132 | then |
133 | # create a device.map |
134 | if [[ ! -f /boot/grub/device.map ]] |
135 | then |
136 | grub-mkdevicemap |
137 | fi |
138 | |
139 | # needed by grub-mkconfig on the first run |
140 | if [[ ! -f /boot/grub/video.lst ]] |
141 | then |
142 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
143 | fi |
144 | |
145 | # update grub.cfg |
146 | grub-mkconfig -o /boot/grub/grub.cfg |
147 | |
148 | # install bootloader to disk |
149 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
150 | local bootdisk |
151 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
152 | |
153 | # Generate core.img, but don't let it be installed in boot sector |
154 | grub-install --no-floppy "${bootdisk}" |
155 | fi |
156 | |
157 | echo |
158 | echo "Begining with GRUB2 the location of the config file has changed." |
159 | echo "You will find it at /boot/grub/grub.cfg" |
160 | echo "Also be aware of the changed commands." |
161 | echo "'kernel' isn't used anymore but 'linux'." |
162 | echo |
163 | } |