aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elivepatch_server/resources/livepatch.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/elivepatch_server/resources/livepatch.py b/elivepatch_server/resources/livepatch.py
index c304f79..a777a68 100644
--- a/elivepatch_server/resources/livepatch.py
+++ b/elivepatch_server/resources/livepatch.py
@@ -67,10 +67,17 @@ class PaTch(object):
print('uuid_dir: ' + str(uuid_dir) + ' PORTAGE_TMPDIR: ' + str(portage_tmpdir))
# portage_tmpdir is not always working with root privileges
if debug:
- env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir,
- 'PORTAGE_DEBUG': '1'}
+ if os.geteuid() != 0:
+ env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir,
+ 'PORTAGE_DEBUG': '1'}
+ else:
+ env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': uuid_dir,
+ 'PORTAGE_DEBUG': '1'}
else:
- env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir}
+ if os.geteuid() != 0:
+ env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir}
+ else:
+ env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': uuid_dir}
_command(['ebuild', ebuild_path, 'clean', 'digest', 'merge'], env=env)
kernel_sources_status = True
else: