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.
pull/8088/head
Thomas Weißschuh 4 years ago committed by Jussi Pakkanen
parent b3c869918b
commit 6b328ef7c4
  1. 2
      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:],

Loading…
Cancel
Save