Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3985 - (show annotations) (download)
Fri Jul 27 19:10:52 2012 UTC (11 years, 10 months ago) by niro
File size: 3697 byte(s)
-fixed includes and alx scripts to work with version 2.00
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
20 etc/grub.d
21 usr/sbin
22 usr/share/grub
23 usr/bin/grub-mkimage
24 usr/bin/grub-editenv
25 usr/bin/grub-mkrelpath
26 usr/bin/grub-script-check
27 usr/share/grub/grub-mkconfig_lib
28 usr/$(mlibdir)/grub/i386-pc"
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/share/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 echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
92 local i
93 for i in ${BINDIR}/etc/grub.d/10_linux \
94 ${BINDIR}/etc/grub.d/20_linux_xen \
95 ${BINDIR}/etc/grub.d/30_os-prober \
96 ${BINDIR}/etc/grub.d/40_custom \
97 ${BINDIR}/etc/grub.d/41_custom \
98 ${BINDIR}/etc/grub.d/README
99 do
100 if [[ -f ${i} ]]
101 then
102 rm ${i} || die
103 fi
104 done
105 mcinjectexec 05_alx_header /etc/grub.d/ || die
106 mcinjectexec 10_alx /etc/grub.d/ || die
107 }
108
109 preinstall()
110 {
111 mount /boot &> /dev/null
112
113 add_conf_prot_mask /etc/grub.d
114 add_conf_prot_ignore /etc/conf.d/grub
115 }
116
117 postinstall()
118 {
119 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
120
121 # creates some essential links
122 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
123
124 # clean up old helpers, which are now consolidated to the '10_alx' script
125 local i
126 for i in 30_alx_hwdetect 40_alx_reset
127 do
128 if [ -f ${MROOT}/etc/grub/${i} ]
129 then
130 rm ${MROOT}/etc/grub/${i}
131 fi
132 done
133
134 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
135 then
136 # create a device.map
137 if [[ ! -f /boot/grub/device.map ]]
138 then
139 grub-mkdevicemap
140 fi
141
142 # needed by grub-mkconfig on the first run
143 if [[ ! -f /boot/grub/video.lst ]]
144 then
145 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
146 fi
147
148 # update grub.cfg
149 grub-mkconfig -o /boot/grub/grub.cfg
150
151 # install bootloader to disk
152 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
153 local bootdisk
154 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
155
156 # Generate core.img, but don't let it be installed in boot sector
157 grub-install --no-floppy "${bootdisk}"
158 fi
159 }