1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-07 13:41:24 +00:00

Fix to initial ~/.workload_automation deployment when sudoing

Only attempt to chown ~/.workload_automation to SUDO_USER if the
effective user is root.
This commit is contained in:
Sergei Trofimov 2015-04-24 10:05:13 +01:00
parent 704324ca77
commit 54e89a2118

View File

@ -151,6 +151,7 @@ def init_environment(env_root, dep_dir, extension_paths, overwrite_existing=Fals
for path in extension_paths: for path in extension_paths:
os.makedirs(path) os.makedirs(path)
if os.getenv('USER') == 'root':
# If running with sudo on POSIX, change the ownership to the real user. # If running with sudo on POSIX, change the ownership to the real user.
real_user = os.getenv('SUDO_USER') real_user = os.getenv('SUDO_USER')
if real_user: if real_user: