commit:     b1bab70c44f772993901189cfe8eab4324db544e
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  9 20:54:39 2018 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jan  9 20:56:35 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1bab70c

net-analyzer/arpwatch: new revision to fix the upgrade path.

All revisions before -r10 install /var/lib/arpwatch with the wrong
ownership. The -r10 revision fixes that for new installs, but doesn't
modify ${ROOT}/var/lib/arpwatch for upgraders. This new -r11 adds a
pkg_postinst function to correct the issue for upgraders.

The revision also changes one "dodir" back to "keepdir", fixing a
mistake that I made in -r10.

Closes: https://bugs.gentoo.org/554222
Package-Manager: Portage-2.3.13, Repoman-2.3.3

 ...2.1.15-r10.ebuild => arpwatch-2.1.15-r11.ebuild} | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/net-analyzer/arpwatch/arpwatch-2.1.15-r10.ebuild 
b/net-analyzer/arpwatch/arpwatch-2.1.15-r11.ebuild
similarity index 69%
rename from net-analyzer/arpwatch/arpwatch-2.1.15-r10.ebuild
rename to net-analyzer/arpwatch/arpwatch-2.1.15-r11.ebuild
index 986da0386f7..758ebf7b054 100644
--- a/net-analyzer/arpwatch/arpwatch-2.1.15-r10.ebuild
+++ b/net-analyzer/arpwatch/arpwatch-2.1.15-r11.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -61,9 +61,26 @@ src_install () {
        doins duplicates.awk euppertolower.awk p.awk e.awk d.awk
 
        diropts --group=arpwatch --mode=770
-       dodir /var/lib/arpwatch
+       keepdir /var/lib/arpwatch
        dodoc README CHANGES
 
        newinitd "${FILESDIR}"/arpwatch.initd-r1 arpwatch
        newconfd "${FILESDIR}"/arpwatch.confd-r1 arpwatch
 }
+
+pkg_postinst() {
+       # Previous revisions installed /var/lib/arpwatch with the wrong
+       # ownership. Instead of the intended arpwatch:root, it was left as
+       # root:root. If we find any such mis-owned directories, we fix them,
+       # and then set the permission bits how we want them in *this*
+       # revision.
+       #
+       # The "--from" flag ensures that we only fix directories that need
+       # fixing, and the "&& chmod" ensures that we only adjust the
+       # permissions if the owner also needed fixing.
+       chown --from=root:root \
+                 --no-dereference \
+                 :arpwatch \
+                 "${ROOT}"/var/lib/arpwatch && \
+               chmod 770 "${ROOT}"/var/lib/arpwatch
+}

Reply via email to