/[gentoo-x86]/eclass/savedconfig.eclass
Gentoo

Diff of /eclass/savedconfig.eclass

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

Revision 1.4 Revision 1.5
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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/eclass/savedconfig.eclass,v 1.4 2007/02/21 20:49:45 dragonheart Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.5 2007/04/23 19:35:05 swegener Exp $
4 4
5# Original Author: Daniel Black <dragonheart@gentoo.org> 5# Original Author: Daniel Black <dragonheart@gentoo.org>
6# 6#
7# Purpose: Define an interface for ebuilds to save and restore 7# Purpose: Define an interface for ebuilds to save and restore
8# complex configuration that may be edited by users. 8# complex configuration that may be edited by users.
78 esac 78 esac
79 local found; 79 local found;
80 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig 80 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig
81 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do 81 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
82 configfile=${base}/${CTARGET}/${check} 82 configfile=${base}/${CTARGET}/${check}
83 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check} 83 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}
84 [[ -r ${configfile} ]] || configfile=${base}/${check} 84 [[ -r ${configfile} ]] || configfile=${base}/${check}
85 einfo "Checking existence of ${configfile} ..." 85 einfo "Checking existence of ${configfile} ..."
86 if [[ -r "${configfile}" ]]; then 86 if [[ -r "${configfile}" ]]; then
87 einfo "found ${configfile}" 87 einfo "found ${configfile}"
88 found=${configfile}; 88 found=${configfile};
89 break; 89 break;
99 dest=${PWD} 99 dest=${PWD}
100 pushd "${found}" 100 pushd "${found}"
101 treecopy . "${dest}" \ 101 treecopy . "${dest}" \
102 || die "Failed to restore ${found} to $1" 102 || die "Failed to restore ${found} to $1"
103 popd 103 popd
104 elif [[ -a {found} ]]; then 104 elif [[ -a {found} ]]; then
105 die "do not know how to handle non-file/directory ${found}" 105 die "do not know how to handle non-file/directory ${found}"
106 else 106 else
107 eerror "No saved config to restore - please remove USE=saveconfig or" 107 eerror "No saved config to restore - please remove USE=saveconfig or"
108 eerror "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}" 108 eerror "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}"
109 die "config file needed when USE=savedconfig is specified" 109 die "config file needed when USE=savedconfig is specified"

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20