/[gentoo-x86]/sys-boot/grub/grub-9999.ebuild
Gentoo

Diff of /sys-boot/grub/grub-9999.ebuild

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.43 Revision 1.44
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.43 2011/10/03 09:10:13 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.44 2011/10/04 18:23:19 scarabeus Exp $
4 4
5EAPI=4 5EAPI=4
6 6
7if [[ ${PV} == "9999" ]] ; then 7if [[ ${PV} == "9999" ]] ; then
8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/" 8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
181 GRUB_ENABLED_PLATFORMS="" 181 GRUB_ENABLED_PLATFORMS=""
182 for i in ${GRUB_PLATFORMS}; do 182 for i in ${GRUB_PLATFORMS}; do
183 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}" 183 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
184 done 184 done
185 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed" 185 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
186 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}" 186 elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
187} 187}
188 188
189src_configure() { 189src_configure() {
190 local i 190 local i
191 191
240 newins "${FILESDIR}"/grub.default grub 240 newins "${FILESDIR}"/grub.default grub
241 cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib 241 cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
242 GRUB_DISTRIBUTOR="Gentoo" 242 GRUB_DISTRIBUTOR="Gentoo"
243EOF 243EOF
244 244
245 elog
246 elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
245 elog "Remember to run emerge --config =${CATEGORY}/${PF} in order" 247 elog "then run 'emerge --config =${CATEGORY}/${PF}'."
246 elog "to set up basic settings for this package." 248
249 # display the link to guide
250 show_doc_url
251}
252
253show_doc_url() {
254 elog
255 elog "For informations how to configure grub-2 please refer to the guide:"
256 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
247} 257}
248 258
249setup_boot_dir() { 259setup_boot_dir() {
250 local dir=$1 260 local dir=$1
251 261 local use_legacy='n'
252 # display the link to guide
253 elog "For informations how to configure grub-2 please refer to the guide:"
254 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
255 262
256 # Make sure target directory exists 263 # Make sure target directory exists
257 mkdir -p "${dir}" 264 mkdir -p "${dir}"
258 265
259 if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then 266 if [[ -e ${dir/2/}/menu.lst ]] ; then
260 # This is first grub2 install and we have old configuraton for 267 # Legacy config exists, ask user what to do
261 # grub1 around. Lets try to generate grub.cfg from it so user 268 einfo "Found legacy GRUB configuration. Do you want to convert it"
262 # does not loose any stuff when rebooting. 269 einfo "instead of using autoconfig (y/N)?"
263 # NOTE: in long term he still NEEDS to migrate to grub.d stuff. 270 read use_legacy
264 einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
265 grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
266 ewarn "Running grub2-menulst2cfg failed!"
267 271
268 einfo "Even if we just created configuration for your grub2 using old" 272 use_legacy=${use_legacy,,[A-Z]}
269 einfo "grub-legacy configuration file you should migrate to use new style" 273 fi
270 einfo "configuration in '${ROOT}/etc/grub.d' and '${ROOT}/etc/defaults/grub'."
271 einfo
272 274
275 if [[ ${use_legacy} == y* ]] ; then
276 grub1_cfg=${dir/2/}/menu.lst
277 grub2_cfg=${dir}/grub.cfg
278
279 # GRUB legacy configuration exists. Use it instead of doing
280 # our normal autoconfigure.
281 #
282
283 einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
284 ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
285 grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
286 eend $?
287
288 ewarn
289 ewarn "Even though the conversion above succeeded, you are STRONGLY"
290 ewarn "URGED to upgrade to the new GRUB2 configuration format."
291
292 # Remind the user about the documentation
293 show_doc_url
273 else 294 else
274 # we need to refresh the grub.cfg everytime just to play it safe 295 # Run GRUB 2 autoconfiguration
296 einfo "Running GRUB 2 autoconfiguration."
275 einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'" 297 ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
276 grub2-mkconfig -o "${dir}/grub.cfg" || \ 298 grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
277 ewarn "Running grub2-mkconfig failed! Check your configuration files!" 299 eend $?
278 fi 300 fi
279 301
280 elog "Remember to run grub2-install to install your grub every time" 302 einfo
281 elog "you update this package!" 303 einfo "Remember to run grub2-install to activate GRUB2 as your default"
304 einfo "bootloader."
282} 305}
283 306
284pkg_config() { 307pkg_config() {
285 local dir 308 local dir
286 309

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.20