summaryrefslogtreecommitdiff
path: root/meson_post_install.py
diff options
context:
space:
mode:
authorJan Rybar <jrybar@redhat.com>2020-10-26 17:00:27 +0000
committerJan Rybar <jrybar@redhat.com>2020-10-26 17:00:27 +0000
commit957a015157fd359d9679540f664183e4b9492896 (patch)
tree41e7f5541d01e479e588cd3dd5a1769e1af0127a /meson_post_install.py
parentff4c2144f0fb1325275887d9e254117fcd8a1b52 (diff)
downloadpolkit-957a015157fd359d9679540f664183e4b9492896.tar.gz
build: Port to meson build system
meson is a build system focused on speed an ease of use, which helps speeding up the software development. This patch adds meson support along autotools.
Diffstat (limited to 'meson_post_install.py')
-rw-r--r--meson_post_install.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..784d491
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import getpass
+import os
+import subprocess
+import sys
+
+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])
+
+polkitd_user = sys.argv[5]
+
+subprocess.check_call(['chmod', '4755', os.path.join(bindir, 'pkexec')])
+
+dst_dirs = [
+ os.path.join(pkgsysconfdir, 'rules.d'),
+ os.path.join(pkgdatadir, 'rules.d')
+]
+
+for dst in dst_dirs:
+ if not os.path.exists(dst):
+ os.makedirs(dst)
+ subprocess.check_call(['chmod', '700', dst])
+ if getpass.getuser() == "root":
+ subprocess.check_call(['chown', polkitd_user, dst])
+
+# polkit-agent-helper-1 need to be setuid root because it's used to
+# authenticate not only the invoking user, but possibly also root
+# and/or other users.
+dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
+subprocess.check_call(['chmod', '4755', dst])
+if getpass.getuser() == "root":
+ subprocess.check_call(['chown', 'root', dst])