| 1 | # Copyright 1999-2007 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/eclass/savedconfig.eclass,v 1.15 2011/07/26 17:35:12 zmedico Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.16 2011/12/27 17:55:12 fauli Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: savedconfig.eclass |
5 | # @ECLASS: savedconfig.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: common API for saving/restoring complex configuration files |
8 | # @BLURB: common API for saving/restoring complex configuration files |
| … | |
… | |
| 30 | die "Bad package! save_config only for use in src_install functions!" |
30 | die "Bad package! save_config only for use in src_install functions!" |
| 31 | fi |
31 | fi |
| 32 | [[ -z "${ED}" ]] && ED=${D} |
32 | [[ -z "${ED}" ]] && ED=${D} |
| 33 | case $# in |
33 | case $# in |
| 34 | 0) die "Tell me what to save" |
34 | 0) die "Tell me what to save" |
| 35 | ;; |
35 | ;; |
| 36 | 1) if [[ -f "$1" ]]; then |
36 | 1) if [[ -f "$1" ]]; then |
| 37 | dodir /etc/portage/savedconfig/${CATEGORY} |
37 | dodir /etc/portage/savedconfig/${CATEGORY} |
| 38 | cp "$1" "${ED}"/etc/portage/savedconfig/${CATEGORY}/${PF} \ |
38 | cp "$1" "${ED}"/etc/portage/savedconfig/${CATEGORY}/${PF} \ |
| 39 | || die "Failed to save $1" |
39 | || die "Failed to save $1" |
| 40 | else |
40 | else |