diff options
author | Ryan Gonzalez <rymg19@gmail.com> | 2018-05-17 09:46:01 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-05-18 17:12:24 +0300 |
commit | 60352521d18e17ce85b944fb3e6af4c71e926773 (patch) | |
tree | 7748b730b3fdcba95acdddc52f00f7abf99d0ea8 /mesonbuild | |
parent | cb34589ede6d223907ae939e4dcd374a8b58bbc0 (diff) | |
download | meson-60352521d18e17ce85b944fb3e6af4c71e926773.zip meson-60352521d18e17ce85b944fb3e6af4c71e926773.tar.gz meson-60352521d18e17ce85b944fb3e6af4c71e926773.tar.bz2 |
Fix #3579: Wait for a permissions failure before trying to run pkexec
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/scripts/meson_install.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py index b0c05cb..d3b6437 100644 --- a/mesonbuild/scripts/meson_install.py +++ b/mesonbuild/scripts/meson_install.py @@ -230,10 +230,6 @@ def do_install(log_dir, datafilename): d.destdir = os.environ.get('DESTDIR', '') d.fullprefix = destdir_join(d.destdir, d.prefix) - if not os.access(d.fullprefix, os.W_OK) and shutil.which('pkexec') is not None: - os.execlp('pkexec', 'pkexec', sys.executable, main_file, *sys.argv[1:], - os.getcwd()) - if d.install_umask is not None: os.umask(d.install_umask) @@ -242,15 +238,23 @@ def do_install(log_dir, datafilename): append_to_log('# List of files installed by Meson') append_to_log('# Does not contain files installed by custom scripts.') - d.dirmaker = DirMaker() - with d.dirmaker: - install_subdirs(d) # Must be first, because it needs to delete the old subtree. - install_targets(d) - install_headers(d) - install_man(d) - install_data(d) - restore_selinux_contexts() - run_install_script(d) + try: + d.dirmaker = DirMaker() + with d.dirmaker: + install_subdirs(d) # Must be first, because it needs to delete the old subtree. + install_targets(d) + install_headers(d) + install_man(d) + install_data(d) + restore_selinux_contexts() + run_install_script(d) + except PermissionError: + if shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ: + os.execlp('pkexec', 'pkexec', sys.executable, main_file, *sys.argv[1:], + os.getcwd()) + else: + raise + def install_subdirs(d): for (src_dir, dst_dir, mode, exclude) in d.install_subdirs: |