upg polkit

This commit is contained in:
joborun linux 2025-01-14 03:52:43 +02:00
parent 5d5561cea2
commit 6cd0749c8f
6 changed files with 307 additions and 25 deletions

View file

@ -0,0 +1,98 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Mon, 13 Jan 2025 23:54:13 +0100
Subject: [PATCH] meson: Support explicit GID
On Arch Linux, the polkitd user is not available during packaging, and
files must be created with a numeric UID and GID.
---
data/meson.build | 8 +++++++-
meson.build | 6 +++++-
meson_options.txt | 1 +
meson_post_install.py | 11 +++++++----
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/data/meson.build b/data/meson.build
index e3776fb8319e..a504dbaca900 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,7 +1,13 @@
+if polkitd_gid != '-'
+ polkitd_sysusers_uid = '@0@:@1@'.format(polkitd_uid, polkitd_gid)
+else
+ polkitd_sysusers_uid = polkitd_uid
+endif
+
service_conf = {
'libprivdir': pk_prefix / pk_libprivdir,
'polkitd_user': polkitd_user,
- 'polkitd_uid': polkitd_uid,
+ 'polkitd_uid': polkitd_sysusers_uid,
}
configure_file(
diff --git a/meson.build b/meson.build
index cf494c2f1158..0605bf975e4c 100644
--- a/meson.build
+++ b/meson.build
@@ -232,7 +232,7 @@ polkitd_user = get_option('polkitd_user')
config_data.set_quoted('POLKITD_USER', polkitd_user)
polkitd_uid = get_option('polkitd_uid')
-config_data.set('POLKITD_UID', polkitd_uid)
+polkitd_gid = get_option('polkitd_gid')
# Select which authentication framework to use
auth_deps = []
@@ -405,6 +405,7 @@ if not libs_only
pk_libprivdir,
pk_pkgsysconfdir,
polkitd_user,
+ polkitd_gid,
)
endif
@@ -433,6 +434,9 @@ output += ' polkitd user: ' + polkitd_user + ' \n'
if polkitd_uid != '-'
output += ' polkitd UID: ' + polkitd_uid + ' \n'
endif
+if polkitd_gid != '-'
+ output += ' polkitd GID: ' + polkitd_gid + ' \n'
+endif
output += ' PAM support: ' + enable_pam.to_string() + '\n\n'
if libs_only
output += ' !!! Only building polkit libraries, not polkitd !!!\n\n'
diff --git a/meson_options.txt b/meson_options.txt
index 31b7a2b0300d..916f365ddeab 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,7 @@ option('systemdsystemunitdir', type: 'string', value: '', description: 'custom d
option('libs-only', type: 'boolean', value: false, description: 'Only build libraries (skips building polkitd)')
option('polkitd_user', type: 'string', value: 'polkitd', description: 'User for running polkitd (polkitd)')
option('polkitd_uid', type: 'string', value: '-', description: 'Fixed UID for user running polkitd (polkitd)')
+option('polkitd_gid', type: 'string', value: '-', description: 'Fixed GID for user running polkitd (polkitd)')
option('privileged_group', type: 'string', value: '', description: 'Group to use for default privileged access (default: wheel)')
option('authfw', type: 'combo', choices: ['pam', 'shadow', 'bsdauth'], value: 'pam', description: 'Authentication framework (pam/shadow)')
diff --git a/meson_post_install.py b/meson_post_install.py
index efb75a1de69b..95a741ef70d0 100644
--- a/meson_post_install.py
+++ b/meson_post_install.py
@@ -21,10 +21,13 @@ pkglibdir = destdir_path(sys.argv[2])
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
+if sys.argv[5] != '-':
+ polkitd_gid = int(sys.argv[5])
+else:
+ try:
+ polkitd_gid = pwd.getpwnam(polkitd_user).pw_gid
+ except KeyError:
+ polkitd_gid = None
dst = os.path.join(bindir, 'pkexec')

View file

@ -0,0 +1,91 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "joborun" <joborun@disroot.org>
Date: Mon, 13 Jan 2025 23:58:58 +0200
Subject: [PATCH] meson: Detect Joborun Linux and set the UID and GID
---
meson.build | 26 ++++++++++++++++++++++----
meson_options.txt | 4 ++--
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 0605bf975e4c..4e5b2ff0c31b 100644
--- a/meson.build
+++ b/meson.build
@@ -231,9 +231,6 @@ endif
polkitd_user = get_option('polkitd_user')
config_data.set_quoted('POLKITD_USER', polkitd_user)
-polkitd_uid = get_option('polkitd_uid')
-polkitd_gid = get_option('polkitd_gid')
-
# Select which authentication framework to use
auth_deps = []
@@ -299,21 +296,42 @@ if os_type == ''
['debian', '/etc/debian_version'],
['gentoo', '/etc/gentoo-release'],
['pardus', '/etc/pardus-release'],
+ ['joborun', '/etc/jobo-release'],
['lfs', '/etc/lfs-release'],
]
foreach os_path: os_paths
if run_command('test', '-e', os_path[1], check: false).returncode() == 0
os_type = os_path[0]
break
endif
endforeach
if os_type == ''
message('Linux distribution autodetection failed, specify the distribution to target using -Dos_type=')
endif
endif
+# The default UID differs between distributions, set it accordingly if not specified
+polkitd_uid = get_option('polkitd_uid')
+if polkitd_uid == ''
+ if os_type == 'joborun'
+ polkitd_uid = '102'
+ else
+ polkitd_uid = '-'
+ endif
+endif
+
+# The default GID differs between distributions, set it accordingly if not specified
+polkitd_gid = get_option('polkitd_gid')
+if polkitd_gid == ''
+ if os_type == 'joborun'
+ polkitd_gid = '102'
+ else
+ polkitd_gid = '-'
+ endif
+endif
+
# The default privileged group differs between distributions, set it accordingly if not specified
privileged_group = get_option('privileged_group')
if privileged_group == ''
@@ -347,7 +365,7 @@ if pam_include == ''
'PAM_FILE_INCLUDE_PASSWORD': 'system-password',
'PAM_FILE_INCLUDE_SESSION': 'system-session',
}
- #if ['redhat', 'gentoo', 'pardus'].contains(os_type)
+ #if ['redhat', 'gentoo', 'pardus', 'joborun'].contains(os_type)
else
pam_conf = {
'PAM_FILE_INCLUDE_AUTH': 'system-auth',
diff --git a/meson_options.txt b/meson_options.txt
index 916f365ddeab..a889406ed515 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,8 +3,8 @@ option('systemdsystemunitdir', type: 'string', value: '', description: 'custom d
option('libs-only', type: 'boolean', value: false, description: 'Only build libraries (skips building polkitd)')
option('polkitd_user', type: 'string', value: 'polkitd', description: 'User for running polkitd (polkitd)')
-option('polkitd_uid', type: 'string', value: '-', description: 'Fixed UID for user running polkitd (polkitd)')
-option('polkitd_gid', type: 'string', value: '-', description: 'Fixed GID for user running polkitd (polkitd)')
+option('polkitd_uid', type: 'string', value: '', description: 'Fixed UID for user running polkitd (polkitd)')
+option('polkitd_gid', type: 'string', value: '', description: 'Fixed GID for user running polkitd (polkitd)')
option('privileged_group', type: 'string', value: '', description: 'Group to use for default privileged access (default: wheel)')
option('authfw', type: 'combo', choices: ['pam', 'shadow', 'bsdauth'], value: 'pam', description: 'Authentication framework (pam/shadow)')

View file

@ -0,0 +1,91 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Mon, 13 Jan 2025 23:55:38 +0100
Subject: [PATCH] meson: Detect Arch Linux and set the UID and GID
---
meson.build | 26 ++++++++++++++++++++++----
meson_options.txt | 4 ++--
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 0605bf975e4c..4e5b2ff0c31b 100644
--- a/meson.build
+++ b/meson.build
@@ -231,9 +231,6 @@ endif
polkitd_user = get_option('polkitd_user')
config_data.set_quoted('POLKITD_USER', polkitd_user)
-polkitd_uid = get_option('polkitd_uid')
-polkitd_gid = get_option('polkitd_gid')
-
# Select which authentication framework to use
auth_deps = []
@@ -299,21 +296,42 @@ if os_type == ''
['debian', '/etc/debian_version'],
['gentoo', '/etc/gentoo-release'],
['pardus', '/etc/pardus-release'],
+ ['arch', '/etc/arch-release'],
['lfs', '/etc/lfs-release'],
]
foreach os_path: os_paths
if run_command('test', '-e', os_path[1], check: false).returncode() == 0
os_type = os_path[0]
break
endif
endforeach
if os_type == ''
message('Linux distribution autodetection failed, specify the distribution to target using -Dos_type=')
endif
endif
+# The default UID differs between distributions, set it accordingly if not specified
+polkitd_uid = get_option('polkitd_uid')
+if polkitd_uid == ''
+ if os_type == 'arch'
+ polkitd_uid = '102'
+ else
+ polkitd_uid = '-'
+ endif
+endif
+
+# The default GID differs between distributions, set it accordingly if not specified
+polkitd_gid = get_option('polkitd_gid')
+if polkitd_gid == ''
+ if os_type == 'arch'
+ polkitd_gid = '102'
+ else
+ polkitd_gid = '-'
+ endif
+endif
+
# The default privileged group differs between distributions, set it accordingly if not specified
privileged_group = get_option('privileged_group')
if privileged_group == ''
@@ -347,7 +365,7 @@ if pam_include == ''
'PAM_FILE_INCLUDE_PASSWORD': 'system-password',
'PAM_FILE_INCLUDE_SESSION': 'system-session',
}
- #if ['redhat', 'gentoo', 'pardus'].contains(os_type)
+ #if ['redhat', 'gentoo', 'pardus', 'arch'].contains(os_type)
else
pam_conf = {
'PAM_FILE_INCLUDE_AUTH': 'system-auth',
diff --git a/meson_options.txt b/meson_options.txt
index 916f365ddeab..a889406ed515 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,8 +3,8 @@ option('systemdsystemunitdir', type: 'string', value: '', description: 'custom d
option('libs-only', type: 'boolean', value: false, description: 'Only build libraries (skips building polkitd)')
option('polkitd_user', type: 'string', value: 'polkitd', description: 'User for running polkitd (polkitd)')
-option('polkitd_uid', type: 'string', value: '-', description: 'Fixed UID for user running polkitd (polkitd)')
-option('polkitd_gid', type: 'string', value: '-', description: 'Fixed GID for user running polkitd (polkitd)')
+option('polkitd_uid', type: 'string', value: '', description: 'Fixed UID for user running polkitd (polkitd)')
+option('polkitd_gid', type: 'string', value: '', description: 'Fixed GID for user running polkitd (polkitd)')
option('privileged_group', type: 'string', value: '', description: 'Group to use for default privileged access (default: wheel)')
option('authfw', type: 'combo', choices: ['pam', 'shadow', 'bsdauth'], value: 'pam', description: 'Authentication framework (pam/shadow)')

View file

@ -6,41 +6,40 @@
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=polkit
pkgver=125
pkgver=126
pkgrel=01
pkgdesc="Application development toolkit for controlling system-wide privileges with ConsoleKit support"
#url="https://gitlab.freedesktop.org/polkit/polkit"
url="https://github.com/polkit-org/polkit"
depends=(duktape expat glib2 glibc pam)
makedepends=(git gobject-introspection gtk-doc meson dbus glib2-devel)
makedepends=(git gobject-introspection gtk-doc meson dbus glib2-devel gettext)
checkdepends=(python-dbusmock)
provides=(polkit=$pkgver libpolkit-{agent,gobject}-1.so)
backup=(etc/pam.d/polkit-1)
install=polkit.install
#options=('!libtool')
source=("git+$url#tag=$pkgver"
0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
0001-meson-Support-explicit-GID.patch
0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
polkit.pam)
# polkit.sysusers.conf
# 99-consolekit.rules)
#pkgver() {
# cd polkit
# git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
#}
prepare() {
cd polkit
git apply -3 ../0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
git apply -3 ../0001-meson-Support-explicit-GID.patch
git apply -3 ../0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
}
build() {
# -D polkitd_uid=102
local meson_options=(
-D examples=true
-D gtk_doc=true
-D man=true
-D gettext=true
-D os_type=gentoo
-D polkitd_uid=102
-D polkitd_user=polkitd
-D session_tracking=ConsoleKit
-D tests=true
@ -68,13 +67,16 @@ arch=(x86_64)
license=(LGPL-2.0-or-later)
b2sums=('3a3d10173937bd7d869e1125878bec0b6f6ac565ffea7bbf61a05634cfbe85471dc62386825a201915c03c48cbcda277704011ec760a283e5b9663ad49cf0237'
'14ba77b12255519008a045706d9c6a06b8f4a5a091b980030b3e216908ac7485c5c70b26a4008d15df7b2c374eaf9dde31c8ba480a6cb1601effbb4b6d6c023b'
b2sums=('20659c1a622208e1db7d5f65c5ab75a6a35c55472b5abdadc5405fb83f678e7eb9fe4ac32b1947f6956cc1204f5caa2cad2f5db81de7ea49cdb13bd309c94fa4'
'b891682aa88beab15cd90a7681060168c5cb4de7c3d75dd9dba13a8281eb8de6ea81436b2dc8ddf404c5016eba422519fc9f28ecd2648c7ac811330196eb4a7d'
'f827d8b110d15e7d331d25ae008a5b2e49cfdbf1f2d01c640e091b280f66ffb70544d86ece48fb0b838db148307bcd0a72fa8d9bd232bf68733ea78a984fa194'
'ead7b003be8f614d18fa1d12740ff00c374c216a52b07631760a4735a11de2d00402f9a93a0cac8eff274a5a39d39048b840eb29e6a5362d2b021369ed2ac0f1')
sha256sums=(e9e4ab882266914a5e19cdcd4f88c47c1117f36b311d63bd39edc17bec2eac35 # polkit
34bc2831f2354a30c87fd71894e4b870e2e73a5840350cc5dda94d61108d1792 # 0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
sha256sums=(8064cf1fd3f118313d7dfd035cbbbf68e02e7c0720b4e44d6ca5f817bf5b68c0 # polkit
f864f311226d79361c3c9e6e5e2ea52c24ded7b9f4c10a9b7586c8c387c66846 # 0001-meson-Support-explicit-GID.patch
806aed198ee17ce9ab5788e55d88a43b593e129e8ac5fcad5895a6405387b261 # 0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
a35af3210bff1a8f2c04add47ed131a17df9eafbbc6f1671f97021be3ab1ff34) # polkit.pam
## ea397fb32baab4459d58ac432e7edda88e62f438a091a9247ca9487035eec9b9 polkit-125-01-x86_64.pkg.tar.lz
## d2f5dc20eeb8fcac7e42bfcd11c7848d2120da90f3d81b18957d518477a08810 polkit-126-01-x86_64.pkg.tar.lz

View file

@ -2,7 +2,7 @@
# Contributor: Jan de Groot <jgc@archlinux.org>
pkgname=polkit
pkgver=125
pkgver=126
pkgrel=1
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://github.com/polkit-org/polkit"
@ -27,29 +27,28 @@ makedepends=(
)
checkdepends=(python-dbusmock)
provides=(libpolkit-{agent,gobject}-1.so)
backup=(etc/pam.d/polkit-1)
install=polkit.install
source=(
"git+$url#tag=$pkgver"
0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
0001-meson-Support-explicit-GID.patch
0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
)
b2sums=('3a3d10173937bd7d869e1125878bec0b6f6ac565ffea7bbf61a05634cfbe85471dc62386825a201915c03c48cbcda277704011ec760a283e5b9663ad49cf0237'
'14ba77b12255519008a045706d9c6a06b8f4a5a091b980030b3e216908ac7485c5c70b26a4008d15df7b2c374eaf9dde31c8ba480a6cb1601effbb4b6d6c023b')
b2sums=('20659c1a622208e1db7d5f65c5ab75a6a35c55472b5abdadc5405fb83f678e7eb9fe4ac32b1947f6956cc1204f5caa2cad2f5db81de7ea49cdb13bd309c94fa4'
'b891682aa88beab15cd90a7681060168c5cb4de7c3d75dd9dba13a8281eb8de6ea81436b2dc8ddf404c5016eba422519fc9f28ecd2648c7ac811330196eb4a7d'
'f6dc32e6b56129bf8e181c2cce91c868eddb9e6c82e3d674f3ce5085c0ecde005b625b621c1ef28d3afbdcfbfc4d7586dbd4dfed5a611f251388c81270bc380b')
prepare() {
cd polkit
git apply -3 ../0001-meson-Pass-polkitd_uid-to-meson_post_install.py.patch
git apply -3 ../0001-meson-Support-explicit-GID.patch
git apply -3 ../0002-meson-Detect-Arch-Linux-and-set-the-UID-and-GID.patch
}
build() {
local meson_options=(
-D examples=true
-D gettext=true
-D gtk_doc=true
-D man=true
-D os_type=redhat
-D polkitd_uid=102
-D polkitd_user=polkitd
-D session_tracking=logind
-D tests=true
)

View file

@ -6,5 +6,6 @@ meson
python-dbusmock
gettext
glib2-devel
gettext