commit:     d642644bfbd0ba605c561fefcbf6df58f30b6a84
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 15 15:22:01 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Dec 15 15:53:24 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d642644b

sys-apps/man-db: move /var cache dir creation to runtime #520464

The rework in pkg_preinst is just about moving the path into a var.
Otherwise, we just add some -d/mkdir testing logic to the end.

 sys-apps/man-db/man-db-2.7.6.1-r1.ebuild | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sys-apps/man-db/man-db-2.7.6.1-r1.ebuild 
b/sys-apps/man-db/man-db-2.7.6.1-r1.ebuild
index 0f4cb33..035cc34 100644
--- a/sys-apps/man-db/man-db-2.7.6.1-r1.ebuild
+++ b/sys-apps/man-db/man-db-2.7.6.1-r1.ebuild
@@ -69,21 +69,21 @@ src_install() {
 
        exeinto /etc/cron.daily
        newexe "${FILESDIR}"/man-db.cron man-db #289884
-
-       keepdir /var/cache/man
-       fowners man:man /var/cache/man
-       fperms 0755 /var/cache/man
 }
 
 pkg_preinst() {
-       if [[ -f ${EROOT}var/cache/man/whatis ]] ; then
-               einfo "Cleaning ${EROOT}var/cache/man from sys-apps/man"
-               find "${EROOT}"var/cache/man -type f '!' '(' -name index.bt -o 
-name index.db ')' -delete
+       local cachedir="${EROOT}var/cache/man"
+       if [[ -f ${cachedir}/whatis ]] ; then
+               einfo "Cleaning ${cachedir} from sys-apps/man"
+               find "${cachedir}" -type f '!' '(' -name index.bt -o -name 
index.db ')' -delete
        fi
-       if [[ -g ${EROOT}var/cache/man ]] ; then
-               einfo "Resetting permissions on ${EROOT}var/cache/man"
-               chown -R man:man "${EROOT}"var/cache/man
-               find "${EROOT}"var/cache/man -type d -exec chmod g-s {} +
+       if [[ -g ${cachedir} ]] ; then
+               einfo "Resetting permissions on ${cachedir}"
+               chown -R man:man "${cachedir}" || die
+               find "${cachedir}" -type d -exec chmod g-s {} + || die
+       elif [[ ! -d ${cachedir} ]] ; then
+               mkdir -p "${cachedir}" || die
+               chown man:man "${cachedir}" || die
        fi
 }
 

Reply via email to