1 |
* Torsten Veller <tove@g.o>: |
2 |
> > pkg_postinst() { |
3 |
> > if [ ! -f ${ROOT}/usr/share/epic/script/local ] |
4 |
> > then |
5 |
> > elog "/usr/share/epic/script/local does not exist, I will now" |
6 |
> > elog "create it. If you do not like the look/feel of this file, or" |
7 |
> > elog "if you'd prefer to use your own script, simply remove this" |
8 |
> > elog "file. If you want to prevent this file from being installed" |
9 |
> > elog "in the future, simply create an empty file with this name." |
10 |
> > cp ${WORKDIR}/epic4-local ${ROOT}/usr/share/epic/script/local |
11 |
> ^^^^^^^^^^^^^^^^^^^^^^ |
12 |
> This probably does not exist. |
13 |
> Installing a default file and testing in pkg_preinst() might be better. |
14 |
> |
15 |
> src_install() { |
16 |
> [...] |
17 |
> newins "${WORKDIR}"/epic4-local local.gentoodefault |
18 |
> [...] |
19 |
> } |
20 |
> pkg_preinst() { |
21 |
> if [ ! -f "${ROOT}"/usr/share/epic/script/local ] && \ |
22 |
> [ ! -f "${D}"/usr/share/epic/script/local ] |
23 |
> then |
24 |
> elog ... |
25 |
> cp "${D}"/usr/share/epic/script/local{.gentoodefault,} |
26 |
> fi |
27 |
> } |
28 |
|
29 |
:( |
30 |
|
31 |
I thought it might be an advantage to record the file. But it isn't. |
32 |
On upgrades portage calls: pkg_preinst, pkg_postinst, pkg_prerm, |
33 |
pkg_postrm. So it first merges the new version and cleans the old one |
34 |
later. |
35 |
|
36 |
So for above pkg_preinst the file exists but it will be removed later |
37 |
(if it wasn't modified) |
38 |
|
39 |
Next version: Use your old pkg_postinst but don't use WOKDIR but the |
40 |
installed default file. (If you don't want to merge the default file to |
41 |
ROOT you install it but move to T in pkg_preinst and to ROOT in pkg_postinst.) |
42 |
|
43 |
Comments? |
44 |
-- |
45 |
.: Torsten Veller | :. |
46 |
-- |
47 |
gentoo-dev@g.o mailing list |