1 |
vapier 12/01/04 06:19:09 |
2 |
|
3 |
Modified: savedconfig.eclass |
4 |
Log: |
5 |
collapse duplicate branches in save_config code paths to keep things simple |
6 |
|
7 |
Revision Changes Path |
8 |
1.17 eclass/savedconfig.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/savedconfig.eclass?rev=1.17&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/savedconfig.eclass?rev=1.17&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/savedconfig.eclass?r1=1.16&r2=1.17 |
13 |
|
14 |
Index: savedconfig.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v |
17 |
retrieving revision 1.16 |
18 |
retrieving revision 1.17 |
19 |
diff -u -r1.16 -r1.17 |
20 |
--- savedconfig.eclass 27 Dec 2011 17:55:12 -0000 1.16 |
21 |
+++ savedconfig.eclass 4 Jan 2012 06:19:09 -0000 1.17 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2011 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.16 2011/12/27 17:55:12 fauli Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.17 2012/01/04 06:19:09 vapier Exp $ |
27 |
|
28 |
# @ECLASS: savedconfig.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -29,25 +29,23 @@ |
31 |
if [[ ${EBUILD_PHASE} != "install" ]]; then |
32 |
die "Bad package! save_config only for use in src_install functions!" |
33 |
fi |
34 |
- [[ -z "${ED}" ]] && ED=${D} |
35 |
- case $# in |
36 |
- 0) die "Tell me what to save" |
37 |
- ;; |
38 |
- 1) if [[ -f "$1" ]]; then |
39 |
- dodir /etc/portage/savedconfig/${CATEGORY} |
40 |
- cp "$1" "${ED}"/etc/portage/savedconfig/${CATEGORY}/${PF} \ |
41 |
- || die "Failed to save $1" |
42 |
- else |
43 |
- dodir /etc/portage/savedconfig/${CATEGORY}/${PF} |
44 |
- treecopy "$1" "${ED}"/etc/portage/savedconfig/${CATEGORY}/${PF} \ |
45 |
- || die "Failed to save $1" |
46 |
- fi |
47 |
- ;; |
48 |
- *) |
49 |
- dodir "${PORTAGE_CONFIGROOT}"/etc/portage/savedconfig/${CATEGORY}/${PF} |
50 |
- treecopy $* "${D}/${PORTAGE_CONFIGROOT}"/etc/portage/savedconfig/${CATEGORY}/${PF} \ |
51 |
- || die "Failed to save $1" |
52 |
- esac |
53 |
+ [[ $# -eq 0 ]] && die "Usage: save_config <files>" |
54 |
+ |
55 |
+ # Be lazy in our EAPI compat |
56 |
+ : ${ED:-${D}} |
57 |
+ |
58 |
+ local dest="/etc/portage/savedconfig/${CATEGORY}" |
59 |
+ if [[ $# -eq 1 && -f $1 ]] ; then |
60 |
+ # Just one file, so have the ${PF} be that config file |
61 |
+ dodir "${dest}" |
62 |
+ cp "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" |
63 |
+ else |
64 |
+ # A dir, or multiple files, so have the ${PF} be a dir |
65 |
+ # with all the saved stuff below it |
66 |
+ dodir "${dest}/${PF}" |
67 |
+ treecopy "$@" "${ED}/${dest}/${PF}" || die "failed to save $*" |
68 |
+ fi |
69 |
+ |
70 |
elog "Your configuration for ${CATEGORY}/${PF} has been saved in " |
71 |
elog "/etc/portage/savedconfig/${CATEGORY}/${PF} for your editing pleasure." |
72 |
elog "You can edit these files by hand and remerge this package with" |