commit:     42190b7caf2d681848601be12d27080c82ef9ecd
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 22 18:54:59 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed Mar 22 19:46:28 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42190b7c

sys-auth/polkit: keepdir /etc/polkit-1/rules.d

Calling keepdir /usr/share/polkit-1/rules.d is pointless because the
package already installs 50-default.rules there.

We want to keepdir /etc/polkit-1/rules.d so that we can ensure the
proper permissions are applied.

Skip setting the mode and owner in src_install if we are not running as
root. This resolves a failure on prefix systems.

Keep the chmod/chown in pkg_postinst to handle upgrades and ensure the
permissions get set if packages are installed out-of-order.

Move both calls behind the 'daemon' USE flag.

Closes: https://github.com/gentoo/gentoo/pull/30298
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../polkit/{polkit-122.ebuild => polkit-122-r1.ebuild}     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sys-auth/polkit/polkit-122.ebuild 
b/sys-auth/polkit/polkit-122-r1.ebuild
similarity index 92%
rename from sys-auth/polkit/polkit-122.ebuild
rename to sys-auth/polkit/polkit-122-r1.ebuild
index 65f7240d5df0..fc80a36e0f16 100644
--- a/sys-auth/polkit/polkit-122.ebuild
+++ b/sys-auth/polkit/polkit-122-r1.ebuild
@@ -144,11 +144,17 @@ src_install() {
                dodoc src/examples/{*.c,*.policy*}
        fi
 
-       diropts -m 0700 -o polkitd
-       keepdir /usr/share/polkit-1/rules.d
+       if use daemon; then
+               if [[ ${EUID} == 0 ]]; then
+                       diropts -m 0700 -o polkitd
+               fi
+               keepdir /etc/polkit-1/rules.d
+       fi
 }
 
 pkg_postinst() {
-       chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
-       chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
+       if use daemon && [[ ${EUID} == 0 ]]; then
+               chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
+               chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
+       fi
 }

Reply via email to