net-analyzer/arpwatch: new revision to fix the upgrade path.
authorMichael Orlitzky <mjo@gentoo.org>
Tue, 9 Jan 2018 20:54:39 +0000 (15:54 -0500)
committerMichael Orlitzky <mjo@gentoo.org>
Tue, 9 Jan 2018 20:56:35 +0000 (15:56 -0500)
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

net-analyzer/arpwatch/arpwatch-2.1.15-r11.ebuild [moved from net-analyzer/arpwatch/arpwatch-2.1.15-r10.ebuild with 69% similarity]

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 986da0386f7dd5bb08f2e021edbb9b4d11d108ca..758ebf7b05486b77ca208030baeb35748e7f0e92 100644 (file)
@@ -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
+}