Magellan Linux

Contents of /smage/trunk/core/grub/grub-2.00-r5.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4821 - (show annotations) (download)
Tue May 7 14:01:01 2013 UTC (11 years, 1 month ago) by niro
File size: 4187 byte(s)
-fixed module and image deletion
1 # $Id$
2
3 PNAME="grub"
4 PVER="2.00"
5 PBUILD="r5"
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 >= 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}-busybox.patch
44 )
45
46 UP2DATE="updatecmd_gnu ${PNAME} gz"
47
48 # grub doesn't like CFLAG optimation,
49 # and do you really want that at your bootloader ??
50 unset CFLAGS
51 unset CXXFLAGS
52
53 src_prepare()
54 {
55 munpack ${SRCFILE} || die
56 cd ${SRCDIR}
57
58 # use /etc/conf.d/grub instead of /etc/default/grub
59 mpatch ${PNAME}-${PVER}-confd.patch || die
60 # cosmetic fixes
61 mpatch ${PNAME}-${PVER}-cosmetic.patch || die
62 # fix ftbfs with newer glibc (>= 2.16)
63 mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die
64
65 # fixes some issues with busybox
66 mpatch ${PNAME}-${PVER}-busybox.patch || die
67 }
68
69 src_compile()
70 {
71 cd ${SRCDIR}
72
73 mconfigure --disable-efiemu --disable-werror --disable-nls || die
74 mmake || die
75 }
76
77 alx_generic_src_install()
78 {
79 cd ${SRCDIR}
80
81 mmake DESTDIR=${BINDIR} install || die
82
83 # set distribution
84 echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
85
86 # install only grub dir, no default config
87 minstalldir /boot/grub || die
88
89 # remove debugging related files
90 rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.module || die
91 rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.image || die
92 mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
93 mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
94 mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
95
96 # docs
97 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
98
99 # setup a proper grub default conf
100 minstalldir /etc/conf.d || die
101 mcinjectfile grub.confd /etc/conf.d/grub || die
102
103 # use custom creation scripts and delete the provided ones
104 echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
105 local i
106 for i in ${BINDIR}/etc/grub.d/10_linux \
107 ${BINDIR}/etc/grub.d/20_linux_xen \
108 ${BINDIR}/etc/grub.d/30_os-prober \
109 ${BINDIR}/etc/grub.d/40_custom \
110 ${BINDIR}/etc/grub.d/41_custom \
111 ${BINDIR}/etc/grub.d/README
112 do
113 if [[ -f ${i} ]]
114 then
115 rm ${i} || die
116 fi
117 done
118 mcinjectexec 05_alx_header /etc/grub.d/ || die
119 mcinjectexec 10_alx /etc/grub.d/ || die
120 }
121
122 preinstall_grub()
123 {
124 mount /boot &> /dev/null
125
126 add_conf_prot_mask /etc/grub.d
127 add_conf_prot_ignore /etc/conf.d/grub
128 }
129
130 postinstall_grub()
131 {
132 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
133
134 # creates some essential links
135 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
136
137 # clean up old helpers, which are now consolidated to the '10_alx' script
138 local i
139 for i in 30_alx_hwdetect 40_alx_reset
140 do
141 if [ -f ${MROOT}/etc/grub/${i} ]
142 then
143 rm ${MROOT}/etc/grub/${i}
144 fi
145 done
146
147 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
148 then
149 # create a device.map
150 if [[ ! -f /boot/grub/device.map ]]
151 then
152 grub-mkdevicemap
153 fi
154
155 # needed by grub-mkconfig on the first run
156 if [[ ! -f /boot/grub/video.lst ]]
157 then
158 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
159 fi
160
161 # update grub.cfg
162 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
163
164 # install bootloader to disk
165 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
166 local bootdisk
167 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
168
169 # Generate core.img, but don't let it be installed in boot sector
170 grub-install --no-floppy "${bootdisk}"
171 fi
172 }