Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2550 - (show annotations) (download)
Sun Jul 3 01:17:10 2011 UTC (12 years, 10 months ago) by niro
File size: 3294 byte(s)
-fixed keep files and colors
1 # $Id$
2
3 PNAME="grub"
4 PVER="1.99"
5 PBUILD="r1"
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 $(mlibdir)/grub/grub-mkconfig_lib
25 $(mlibdir)/grub/update-grub_lib
26 $(mlibdir)/grub/i386-pc"
27
28 REMOVE_DEPRECATED_MAGE_TARGETS=1
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}-busybox.patch
36 )
37
38 UP2DATE="updatecmd_gnu ${PNAME} gz"
39
40 # grub doesn't like CFLAG optimation,
41 # and do you really want that at your bootloader ??
42 unset CFLAGS
43 unset CXXFLAGS
44
45 src_prepare()
46 {
47 munpack ${SRCFILE} || die
48 cd ${SRCDIR}
49
50 # use /etc/conf.d/grub instead of /etc/default/grub
51 mpatch ${PNAME}-${PVER}-confd.patch || die
52
53 # fixes some issues with busybox
54 mpatch ${PNAME}-${PVER}-busybox.patch || die
55 }
56
57 src_compile()
58 {
59 cd ${SRCDIR}
60
61 mconfigure \
62 --sbindir=/sbin \
63 --bindir=/bin \
64 --libdir=/$(mlibdir) \
65 --disable-efiemu \
66 --disable-werror \
67 --disable-nls \
68 || die
69
70 mmake || die
71 }
72
73 src_install()
74 {
75 cd ${SRCDIR}
76
77 mmake DESTDIR=${BINDIR} install || die
78
79 # fix a missing symlink
80 mlink /bin/grub-mkimage /sbin || die
81
82 # install only grub dir, no default config
83 minstalldir /boot/grub || die
84
85 # docs
86 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
87
88 # setup a proper grub default conf
89 minstalldir /etc/conf.d || die
90 mcinjectfile grub.confd /etc/conf.d/grub || die
91
92 # user custom creation scripts and delete the provided ones
93 local i
94 for i in ${BINDIR}/etc/grub.d/10_* \
95 ${BINDIR}/etc/grub.d/20_* \
96 ${BINDIR}/etc/grub.d/30_* \
97 ${BINDIR}/etc/grub.d/40_* \
98 ${BINDIR}/etc/grub.d/41_* \
99 ${BINDIR}/etc/grub.d/README
100 do
101 if [[ -f ${i} ]]
102 then
103 rm ${i} || die
104 fi
105 done
106 mcinjectexec 05_alx_header /etc/grub.d/ || die
107 mcinjectexec 10_alx /etc/grub.d/ || die
108 mcinjectexec 30_alx_hwdetect /etc/grub.d/ || die
109 mcinjectexec 40_alx_reset /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 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
128 then
129 # create a device.map
130 if [[ ! -f /boot/grub/device.map ]]
131 then
132 grub-mkdevicemap
133 fi
134
135 # update grub.cfg
136 grub-mkconfig -o /boot/grub/grub.cfg
137
138 # install bootloader to disk
139 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
140 local bootdisk
141 bootdisk="$(grub-probe --target=drive | sed 's:(\(.*\),.*):(\1):')"
142
143 # Generate core.img, but don't let it be installed in boot sector
144 grub-install --no-floppy "${bootdisk}"
145 fi
146
147 echo
148 echo "Begining with GRUB2 the location of the config file has changed."
149 echo "You will find it at /boot/grub/grub.cfg"
150 echo "Also be aware of the changed commands."
151 echo "'kernel' isn't used anymore but 'linux'."
152 echo
153 }