jobextra/polkit/0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch

43 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Wed, 17 Jan 2024 20:57:44 +0100
Subject: [PATCH] meson: Pass polkitd_uid to meson_post_install.py
So it can change the rules.d GID without the group being defined.
---
meson.build | 1 +
meson_post_install.py | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index 302c18961e2d..2bd62bea4aa4 100644
--- a/meson.build
+++ b/meson.build
@@ -385,6 +385,7 @@ if not libs_only
pk_libprivdir,
pk_pkgsysconfdir,
polkitd_user,
+ polkitd_uid, # Actually needs the GID, but we assume UID == GID
)
endif
diff --git a/meson_post_install.py b/meson_post_install.py
index efb75a1de69b..2367ef33fbc1 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -22,9 +22,12 @@ pkgsysconfdir = destdir_path(sys.argv[3])
polkitd_user = sys.argv[4]
try:
- polkitd_gid = pwd.getpwnam(polkitd_user).pw_gid
-except KeyError:
- polkitd_gid = None
+ polkitd_gid = int(sys.argv[5]) # Actually the UID, but we assume UID == GID
+except ValueError:
+ try:
+ polkitd_gid = pwd.getpwnam(polkitd_user).pw_gid
+ except KeyError:
+ polkitd_gid = None
dst = os.path.join(bindir, 'pkexec')