Gentoo Archives: gentoo-commits

From: "Tomas Chvatal (scarabeus)" <scarabeus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/grub: grub-1.99-r2.ebuild ChangeLog grub-9999.ebuild
Date: Tue, 04 Oct 2011 18:23:30
Message-Id: 20111004182319.4648B2004B@flycatcher.gentoo.org
1 scarabeus 11/10/04 18:23:19
2
3 Modified: grub-1.99-r2.ebuild ChangeLog grub-9999.ebuild
4 Log:
5 Include option to prompt for grub1 configuration. Thanks to Robert Trace rtrace{at}farcaster.org for the patch.
6
7 (Portage version: 2.2.0_alpha60/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.5 sys-boot/grub/grub-1.99-r2.ebuild
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild?rev=1.5&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild?rev=1.5&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild?r1=1.4&r2=1.5
15
16 Index: grub-1.99-r2.ebuild
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild,v
19 retrieving revision 1.4
20 retrieving revision 1.5
21 diff -u -r1.4 -r1.5
22 --- grub-1.99-r2.ebuild 3 Oct 2011 09:10:13 -0000 1.4
23 +++ grub-1.99-r2.ebuild 4 Oct 2011 18:23:19 -0000 1.5
24 @@ -1,6 +1,6 @@
25 # Copyright 1999-2011 Gentoo Foundation
26 # Distributed under the terms of the GNU General Public License v2
27 -# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild,v 1.4 2011/10/03 09:10:13 scarabeus Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-1.99-r2.ebuild,v 1.5 2011/10/04 18:23:19 scarabeus Exp $
29
30 EAPI=4
31
32 @@ -187,7 +187,7 @@
33 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
34 done
35 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
36 - einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
37 + elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
38 }
39
40 src_configure() {
41 @@ -246,43 +246,66 @@
42 GRUB_DISTRIBUTOR="Gentoo"
43 EOF
44
45 - elog "Remember to run emerge --config =${CATEGORY}/${PF} in order"
46 - elog "to set up basic settings for this package."
47 -}
48 -
49 -setup_boot_dir() {
50 - local dir=$1
51 + elog
52 + elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
53 + elog "then run 'emerge --config =${CATEGORY}/${PF}'."
54
55 # display the link to guide
56 + show_doc_url
57 +}
58 +
59 +show_doc_url() {
60 + elog
61 elog "For informations how to configure grub-2 please refer to the guide:"
62 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
63 +}
64 +
65 +setup_boot_dir() {
66 + local dir=$1
67 + local use_legacy='n'
68
69 # Make sure target directory exists
70 mkdir -p "${dir}"
71
72 - if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then
73 - # This is first grub2 install and we have old configuraton for
74 - # grub1 around. Lets try to generate grub.cfg from it so user
75 - # does not loose any stuff when rebooting.
76 - # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
77 - einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
78 - grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
79 - ewarn "Running grub2-menulst2cfg failed!"
80 -
81 - einfo "Even if we just created configuration for your grub2 using old"
82 - einfo "grub-legacy configuration file you should migrate to use new style"
83 - einfo "configuration in '${ROOT}/etc/grub.d' and '${ROOT}/etc/defaults/grub'."
84 - einfo
85 + if [[ -e ${dir/2/}/menu.lst ]] ; then
86 + # Legacy config exists, ask user what to do
87 + einfo "Found legacy GRUB configuration. Do you want to convert it"
88 + einfo "instead of using autoconfig (y/N)?"
89 + read use_legacy
90 +
91 + use_legacy=${use_legacy,,[A-Z]}
92 + fi
93 +
94 + if [[ ${use_legacy} == y* ]] ; then
95 + grub1_cfg=${dir/2/}/menu.lst
96 + grub2_cfg=${dir}/grub.cfg
97 +
98 + # GRUB legacy configuration exists. Use it instead of doing
99 + # our normal autoconfigure.
100 + #
101 +
102 + einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
103 + ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
104 + grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
105 + eend $?
106 +
107 + ewarn
108 + ewarn "Even though the conversion above succeeded, you are STRONGLY"
109 + ewarn "URGED to upgrade to the new GRUB2 configuration format."
110
111 + # Remind the user about the documentation
112 + show_doc_url
113 else
114 - # we need to refresh the grub.cfg everytime just to play it safe
115 - einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'"
116 - grub2-mkconfig -o "${dir}/grub.cfg" || \
117 - ewarn "Running grub2-mkconfig failed! Check your configuration files!"
118 + # Run GRUB 2 autoconfiguration
119 + einfo "Running GRUB 2 autoconfiguration."
120 + ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
121 + grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
122 + eend $?
123 fi
124
125 - elog "Remember to run grub2-install to install your grub every time"
126 - elog "you update this package!"
127 + einfo
128 + einfo "Remember to run grub2-install to activate GRUB2 as your default"
129 + einfo "bootloader."
130 }
131
132 pkg_config() {
133
134
135
136 1.169 sys-boot/grub/ChangeLog
137
138 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.169&view=markup
139 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.169&content-type=text/plain
140 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?r1=1.168&r2=1.169
141
142 Index: ChangeLog
143 ===================================================================
144 RCS file: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v
145 retrieving revision 1.168
146 retrieving revision 1.169
147 diff -u -r1.168 -r1.169
148 --- ChangeLog 3 Oct 2011 09:10:13 -0000 1.168
149 +++ ChangeLog 4 Oct 2011 18:23:19 -0000 1.169
150 @@ -1,6 +1,11 @@
151 # ChangeLog for sys-boot/grub
152 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
153 -# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.168 2011/10/03 09:10:13 scarabeus Exp $
154 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.169 2011/10/04 18:23:19 scarabeus Exp $
155 +
156 + 04 Oct 2011; Tomáš Chvátal <scarabeus@g.o> grub-1.99-r2.ebuild,
157 + grub-9999.ebuild:
158 + Include option to prompt for grub1 configuration. Thanks to Robert Trace
159 + rtrace{at}farcaster.org for the patch.
160
161 03 Oct 2011; Tomáš Chvátal <scarabeus@g.o> grub-1.99-r2.ebuild,
162 grub-9999.ebuild:
163
164
165
166 1.44 sys-boot/grub/grub-9999.ebuild
167
168 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-9999.ebuild?rev=1.44&view=markup
169 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-9999.ebuild?rev=1.44&content-type=text/plain
170 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-9999.ebuild?r1=1.43&r2=1.44
171
172 Index: grub-9999.ebuild
173 ===================================================================
174 RCS file: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v
175 retrieving revision 1.43
176 retrieving revision 1.44
177 diff -u -r1.43 -r1.44
178 --- grub-9999.ebuild 3 Oct 2011 09:10:13 -0000 1.43
179 +++ grub-9999.ebuild 4 Oct 2011 18:23:19 -0000 1.44
180 @@ -1,6 +1,6 @@
181 # Copyright 1999-2011 Gentoo Foundation
182 # Distributed under the terms of the GNU General Public License v2
183 -# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.43 2011/10/03 09:10:13 scarabeus Exp $
184 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.44 2011/10/04 18:23:19 scarabeus Exp $
185
186 EAPI=4
187
188 @@ -183,7 +183,7 @@
189 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
190 done
191 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
192 - einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
193 + elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
194 }
195
196 src_configure() {
197 @@ -242,43 +242,66 @@
198 GRUB_DISTRIBUTOR="Gentoo"
199 EOF
200
201 - elog "Remember to run emerge --config =${CATEGORY}/${PF} in order"
202 - elog "to set up basic settings for this package."
203 -}
204 -
205 -setup_boot_dir() {
206 - local dir=$1
207 + elog
208 + elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
209 + elog "then run 'emerge --config =${CATEGORY}/${PF}'."
210
211 # display the link to guide
212 + show_doc_url
213 +}
214 +
215 +show_doc_url() {
216 + elog
217 elog "For informations how to configure grub-2 please refer to the guide:"
218 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
219 +}
220 +
221 +setup_boot_dir() {
222 + local dir=$1
223 + local use_legacy='n'
224
225 # Make sure target directory exists
226 mkdir -p "${dir}"
227
228 - if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then
229 - # This is first grub2 install and we have old configuraton for
230 - # grub1 around. Lets try to generate grub.cfg from it so user
231 - # does not loose any stuff when rebooting.
232 - # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
233 - einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
234 - grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
235 - ewarn "Running grub2-menulst2cfg failed!"
236 -
237 - einfo "Even if we just created configuration for your grub2 using old"
238 - einfo "grub-legacy configuration file you should migrate to use new style"
239 - einfo "configuration in '${ROOT}/etc/grub.d' and '${ROOT}/etc/defaults/grub'."
240 - einfo
241 + if [[ -e ${dir/2/}/menu.lst ]] ; then
242 + # Legacy config exists, ask user what to do
243 + einfo "Found legacy GRUB configuration. Do you want to convert it"
244 + einfo "instead of using autoconfig (y/N)?"
245 + read use_legacy
246 +
247 + use_legacy=${use_legacy,,[A-Z]}
248 + fi
249 +
250 + if [[ ${use_legacy} == y* ]] ; then
251 + grub1_cfg=${dir/2/}/menu.lst
252 + grub2_cfg=${dir}/grub.cfg
253 +
254 + # GRUB legacy configuration exists. Use it instead of doing
255 + # our normal autoconfigure.
256 + #
257 +
258 + einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
259 + ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
260 + grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
261 + eend $?
262 +
263 + ewarn
264 + ewarn "Even though the conversion above succeeded, you are STRONGLY"
265 + ewarn "URGED to upgrade to the new GRUB2 configuration format."
266
267 + # Remind the user about the documentation
268 + show_doc_url
269 else
270 - # we need to refresh the grub.cfg everytime just to play it safe
271 - einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'"
272 - grub2-mkconfig -o "${dir}/grub.cfg" || \
273 - ewarn "Running grub2-mkconfig failed! Check your configuration files!"
274 + # Run GRUB 2 autoconfiguration
275 + einfo "Running GRUB 2 autoconfiguration."
276 + ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
277 + grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
278 + eend $?
279 fi
280
281 - elog "Remember to run grub2-install to install your grub every time"
282 - elog "you update this package!"
283 + einfo
284 + einfo "Remember to run grub2-install to activate GRUB2 as your default"
285 + einfo "bootloader."
286 }
287
288 pkg_config() {