Magellan Linux

Contents of /smage/branches/alx-0_6_0/core/grub/grub-1.99-r9.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4845 - (show annotations) (download)
Mon May 13 12:02:55 2013 UTC (10 years, 11 months ago) by niro
File size: 3562 byte(s)
-rev bump to 1.99-r9, improved KMS support and fixed a typo in 10_alx
1 # $Id$
2
3 PNAME="grub"
4 PVER="1.99"
5 PBUILD="r9"
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 # use 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 }
113
114 preinstall()
115 {
116 mount /boot &> /dev/null
117
118 add_conf_prot_mask /etc/grub.d
119 add_conf_prot_ignore /etc/conf.d/grub
120 }
121
122 postinstall()
123 {
124 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
125
126 # creates some essential links
127 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
128
129 # clean up old helpers, which are now consolidated to the '10_alx' script
130 local i
131 for i in 30_alx_hwdetect 40_alx_reset
132 do
133 if [ -f ${MROOT}/etc/grub/${i} ]
134 then
135 rm ${MROOT}/etc/grub/${i}
136 fi
137 done
138
139 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
140 then
141 # create a device.map
142 if [[ ! -f /boot/grub/device.map ]]
143 then
144 grub-mkdevicemap
145 fi
146
147 # needed by grub-mkconfig on the first run
148 if [[ ! -f /boot/grub/video.lst ]]
149 then
150 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
151 fi
152
153 # update grub.cfg
154 grub-mkconfig -o /boot/grub/grub.cfg
155
156 # install bootloader to disk
157 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
158 local bootdisk
159 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
160
161 # Generate core.img, but don't let it be installed in boot sector
162 grub-install --no-floppy "${bootdisk}"
163 fi
164 }