summaryrefslogtreecommitdiff
path: root/polkit
diff options
context:
space:
mode:
authorTim Biermann <tbier@posteo.de>2021-06-06 12:02:05 +0000
committerTim Biermann <tbier@posteo.de>2021-06-06 12:02:22 +0000
commit16f61743354897f7d472d420e77583091724e3a8 (patch)
treedda87e5fe32a8b3591c13c8f7313ff2479b75fc4 /polkit
parent1f6bb204396bfd9ad1422550c91d37a3907ca023 (diff)
downloadopt-16f61743354897f7d472d420e77583091724e3a8.tar.gz
opt-16f61743354897f7d472d420e77583091724e3a8.tar.xz
polkit: fixed build with fakeroot
Diffstat (limited to 'polkit')
-rw-r--r--polkit/.signature5
-rw-r--r--polkit/84.patch190
-rw-r--r--polkit/Pkgfile4
3 files changed, 196 insertions, 3 deletions
diff --git a/polkit/.signature b/polkit/.signature
index c7f0df974..4c7af1f55 100644
--- a/polkit/.signature
+++ b/polkit/.signature
@@ -1,6 +1,7 @@
untrusted comment: verify with /etc/ports/opt.pub
-RWSE3ohX2g5d/dNLIHp6fFNDvD6RvJdDpPsCK41IFQPsHpR4gqcnjIBEQukQtqN0iX8UyH/fmBFojpjaRMatBp6CiDveAyiddQQ=
-SHA256 (Pkgfile) = 8d177cb2f7b0c52000186bed0140a68a0e8e0bdec20bdac46d72ae3a101b6696
+RWSE3ohX2g5d/fZDUwYt0bbgrqPNZmhd4dCcX9Wbgh6YN5jcSfuy5WtPlGrhVFOC68MryqHW8GZE2bqkP6Lckex3FIW6Y1LmpAM=
+SHA256 (Pkgfile) = 96ef7c8246bd0e463a5f2e6ee1e6ded250029c0727eebff84623356f110deaef
SHA256 (.footprint) = 2f612468d5670bf6daec243f680431599fa34f1a249ab55f2015cb81269bdbae
SHA256 (polkit-0.119.tar.gz) = c8579fdb86e94295404211285fee0722ad04893f0213e571bd75c00972fd1f5c
SHA256 (polkit-1) = 9045eb2a1e2e403b0144d14a5cfe903dc97cfef979c956815a56777c0eb1bf1a
+SHA256 (84.patch) = fd72df3d7d8ae26cece76f8e449b5f332a8bbf84725bcb6d260e00123cdc4f70
diff --git a/polkit/84.patch b/polkit/84.patch
new file mode 100644
index 000000000..66ed8c435
--- /dev/null
+++ b/polkit/84.patch
@@ -0,0 +1,190 @@
+From 0b59685e8f3729852a175777bceeccbe34870460 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Thu, 3 Jun 2021 17:11:46 +0100
+Subject: [PATCH 1/8] meson_post_install: Use geteuid instead of getpass
+
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ meson_post_install.py | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index 0a0fccf..a87b711 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -1,6 +1,5 @@
+ #!/usr/bin/env python3
+
+-import getpass
+ import os
+ import pwd
+ import sys
+@@ -24,7 +23,7 @@ dst_dirs = [
+ for dst in dst_dirs:
+ if not os.path.exists(dst):
+ os.makedirs(dst, mode=0o700)
+- if getpass.getuser() == "root":
++ if os.geteuid() == 0:
+ os.chown(dst, polkitd_uid, -1)
+
+ # polkit-agent-helper-1 need to be setuid root because it's used to
+@@ -32,5 +31,5 @@ for dst in dst_dirs:
+ # and/or other users.
+ dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
+ os.chmod(dst, 0o4755)
+-if getpass.getuser() == "root":
++if os.geteuid() == 0:
+ os.chown(dst, 0, -1)
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index a87b711..ef69bb2 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -11,7 +11,10 @@ pkgdatadir = os.path.join(prefix, sys.argv[2])
+ pkglibdir = os.path.join(prefix, sys.argv[3])
+ pkgsysconfdir = os.path.join(prefix, sys.argv[4])
+
+-polkitd_uid = pwd.getpwnam(sys.argv[5]).pw_uid
++try:
++ polkitd_uid = pwd.getpwnam(sys.argv[5]).pw_uid
++except KeyError:
++ polkitd_uid = None
+
+ os.chmod(os.path.join(bindir, 'pkexec'), 0o4775)
+
+@@ -23,7 +26,7 @@ dst_dirs = [
+ for dst in dst_dirs:
+ if not os.path.exists(dst):
+ os.makedirs(dst, mode=0o700)
+- if os.geteuid() == 0:
++ if os.geteuid() == 0 and polkitd_uid is not None:
+ os.chown(dst, polkitd_uid, -1)
+
+ # polkit-agent-helper-1 need to be setuid root because it's used to
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index ef69bb2..de42531 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -10,9 +10,10 @@ bindir = os.path.join(prefix, sys.argv[1])
+ pkgdatadir = os.path.join(prefix, sys.argv[2])
+ pkglibdir = os.path.join(prefix, sys.argv[3])
+ pkgsysconfdir = os.path.join(prefix, sys.argv[4])
++polkitd_user = sys.argv[5]
+
+ try:
+- polkitd_uid = pwd.getpwnam(sys.argv[5]).pw_uid
++ polkitd_uid = pwd.getpwnam(polkitd_user).pw_uid
+ except KeyError:
+ polkitd_uid = None
+
+@@ -28,6 +29,12 @@ for dst in dst_dirs:
+ os.makedirs(dst, mode=0o700)
+ if os.geteuid() == 0 and polkitd_uid is not None:
+ os.chown(dst, polkitd_uid, -1)
++ else:
++ print(
++ 'Owner of {} needs to be set to {} after installation'.format(
++ dst, polkitd_user,
++ )
++ )
+
+ # polkit-agent-helper-1 need to be setuid root because it's used to
+ # authenticate not only the invoking user, but possibly also root
+@@ -36,3 +43,7 @@ dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
+ os.chmod(dst, 0o4755)
+ if os.geteuid() == 0:
+ os.chown(dst, 0, -1)
++else:
++ print(
++ 'Owner of {} needs to be set to root after installation'.format(dst)
++ )
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index de42531..94ffa57 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -17,7 +17,7 @@ try:
+ except KeyError:
+ polkitd_uid = None
+
+-os.chmod(os.path.join(bindir, 'pkexec'), 0o4775)
++os.chmod(os.path.join(bindir, 'pkexec'), 0o4755)
+
+ dst_dirs = [
+ os.path.join(pkgsysconfdir, 'rules.d'),
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index 94ffa57..85cd0ea 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -17,7 +17,18 @@ try:
+ except KeyError:
+ polkitd_uid = None
+
+-os.chmod(os.path.join(bindir, 'pkexec'), 0o4755)
++dst = os.path.join(bindir, 'pkexec')
++
++if os.geteuid() == 0:
++ os.chmod(dst, 0o4755)
++ os.chown(dst, 0, -1)
++else:
++ print(
++ 'Owner and mode of {} need to be setuid root (04755) after '
++ 'installation'.format(
++ dst,
++ )
++ )
+
+ dst_dirs = [
+ os.path.join(pkgsysconfdir, 'rules.d'),
+@@ -40,10 +51,14 @@ for dst in dst_dirs:
+ # authenticate not only the invoking user, but possibly also root
+ # and/or other users.
+ dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
+-os.chmod(dst, 0o4755)
++
+ if os.geteuid() == 0:
++ os.chmod(dst, 0o4755)
+ os.chown(dst, 0, -1)
+ else:
+ print(
+- 'Owner of {} needs to be set to root after installation'.format(dst)
++ 'Owner and mode of {} need to be setuid root (04755) after '
++ 'installation'.format(
++ dst,
++ )
+ )
+
+diff --git a/meson_post_install.py b/meson_post_install.py
+index 85cd0ea..0ab7469 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -4,12 +4,22 @@ import os
+ import pwd
+ import sys
+
++destdir = os.environ.get('DESTDIR')
+ prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
+
+-bindir = os.path.join(prefix, sys.argv[1])
+-pkgdatadir = os.path.join(prefix, sys.argv[2])
+-pkglibdir = os.path.join(prefix, sys.argv[3])
+-pkgsysconfdir = os.path.join(prefix, sys.argv[4])
++def destdir_path(p):
++ if os.path.isabs(p):
++ if destdir is None:
++ return p
++ else:
++ return os.path.join(destdir, os.path.relpath(p, '/'))
++ else:
++ return os.path.join(prefix, p)
++
++bindir = destdir_path(sys.argv[1])
++pkgdatadir = destdir_path(sys.argv[2])
++pkglibdir = destdir_path(sys.argv[3])
++pkgsysconfdir = destdir_path(sys.argv[4])
+ polkitd_user = sys.argv[5]
+
+ try:
+
diff --git a/polkit/Pkgfile b/polkit/Pkgfile
index 4698cb89f..0492c290e 100644
--- a/polkit/Pkgfile
+++ b/polkit/Pkgfile
@@ -7,15 +7,17 @@ name=polkit
version=0.119
release=1
source=(https://freedesktop.org/software/polkit/releases/$name-$version.tar.gz
- polkit-1)
+ polkit-1 84.patch)
build() {
+ patch -Np1 -d $name-$version -i $SRC/84.patch
meson setup $name-$version build \
--prefix=/usr \
--buildtype=plain
meson compile -C build
DESTDIR=$PKG meson install -C build
+ chmod 4775 $PKG/usr/bin/pkexec
install -m 0644 $SRC/polkit-1 $PKG/etc/pam.d
rm -r $PKG/usr/share/locale

Generated by cgit