about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorgimbles <yusharora@protonmail.com>2022-04-10 20:51:11 +0530
committergimbles <yusharora@protonmail.com>2022-04-10 20:51:11 +0530
commit386ca6acc358fc81028680a45c8f3695c2988fef (patch)
treea967523a285fea656761636475d74daf44de7c21 /src/bootstrap
parent949b98cab8a186b98bf87e64374b8d0848c55271 (diff)
downloadrust-386ca6acc358fc81028680a45c8f3695c2988fef.tar.gz
rust-386ca6acc358fc81028680a45c8f3695c2988fef.zip
Allow usage of sudo while not accessing root
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/bootstrap.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 71b8f3c4553..927e686070f 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -1161,9 +1161,9 @@ class RustBuild(object):
         """Check that vendoring is configured properly"""
         vendor_dir = os.path.join(self.rust_root, 'vendor')
         if 'SUDO_USER' in os.environ and not self.use_vendored_sources:
-            if os.environ.get('USER') != os.environ['SUDO_USER']:
+            if os.getuid() == 0:
                 self.use_vendored_sources = True
-                print('info: looks like you are running this command under `sudo`')
+                print('info: looks like you\'re trying to run this command as root')
                 print('      and so in order to preserve your $HOME this will now')
                 print('      use vendored sources by default.')
                 if not os.path.exists(vendor_dir):