summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrusty-snake <41237666+rusty-snake@users.noreply.github.com>2024-12-21 14:50:40 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2025-01-07 21:40:14 +0200
commitc66a89fdca79d29d8799b470bed392b0b80f4d00 (patch)
tree7aeb91318070e1bc2f01ce4972ce77297b6ff5f9
parent0310ab6c6db1938fd94345bbe8c54bf6c33b90fd (diff)
downloadmeson-c66a89fdca79d29d8799b470bed392b0b80f4d00.tar.gz
Add run0 as a way to raise privileges
-rw-r--r--docs/markdown/Installing.md2
-rw-r--r--mesonbuild/minstall.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/docs/markdown/Installing.md b/docs/markdown/Installing.md
index 2d18c178f..0a7ca9f16 100644
--- a/docs/markdown/Installing.md
+++ b/docs/markdown/Installing.md
@@ -115,7 +115,7 @@ running `sudo meson install` will drop permissions and rebuild out of date
targets as the original user, not as root.
*(since 1.1.0)* Re-invoking as root will try to guess the user's preferred method for
-re-running commands as root. The order of precedence is: sudo, doas, pkexec
+re-running commands as root. The order of precedence is: sudo, doas, run0, pkexec
(polkit). An elevation tool can be forced by setting `$MESON_ROOT_CMD`.
## DESTDIR support
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 860826bf1..0bb1691eb 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -564,7 +564,12 @@ class Installer:
if is_windows() or destdir != '' or not os.isatty(sys.stdout.fileno()) or not os.isatty(sys.stderr.fileno()):
# can't elevate to root except in an interactive unix environment *and* when not doing a destdir install
raise
- rootcmd = os.environ.get('MESON_ROOT_CMD') or shutil.which('sudo') or shutil.which('doas')
+ rootcmd = (
+ os.environ.get('MESON_ROOT_CMD')
+ or shutil.which('sudo')
+ or shutil.which('doas')
+ or shutil.which('run0')
+ )
pkexec = shutil.which('pkexec')
if rootcmd is None and pkexec is not None and 'PKEXEC_UID' not in os.environ:
rootcmd = pkexec