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.
@@ -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:],
