aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2020-12-08 08:37:21 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2020-12-10 00:26:28 +0200
commit6b328ef7c4dbc0e4a1079f9fe7aa885c66c85d2a (patch)
tree102a4dc84c9a9fb5ae5decbcfd0f271876d2b1ad
parentb3c869918ba162ed1fe7084883d93e32cc22cfb9 (diff)
downloadmeson-6b328ef7c4dbc0e4a1079f9fe7aa885c66c85d2a.zip
meson-6b328ef7c4dbc0e4a1079f9fe7aa885c66c85d2a.tar.gz
meson-6b328ef7c4dbc0e4a1079f9fe7aa885c66c85d2a.tar.bz2
install: don't elevate when using destdir
Previously the destdir was ignored completely when using elevated privileges to install files as pkexec stripped the DESTDIR environment variable. As the destdir is not supposed to require any special privileges anyways, just re-raise the error.
-rw-r--r--mesonbuild/minstall.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 0eaa54f..47bb88b 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -381,7 +381,7 @@ class Installer:
self.log('Preserved {} unchanged files, see {} for the full list'
.format(self.preserved_file_count, os.path.normpath(self.lf.name)))
except PermissionError:
- if shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ:
+ if shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ and d.destdir is None:
print('Installation failed due to insufficient permissions.')
print('Attempting to use polkit to gain elevated privileges...')
os.execlp('pkexec', 'pkexec', sys.executable, main_file, *sys.argv[1:],