aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alice.ferrazzi@gmail.com>2017-08-23 01:26:48 +0900
committerAlice Ferrazzi <alice.ferrazzi@gmail.com>2017-08-23 01:26:48 +0900
commit608ec892541e7a70b18566c3a2084989b7621573 (patch)
treeb26b7bd59563a86a0f1fe7567fc4c779aee376cf
parentadded shelve db for remember already installed cve patch (diff)
downloadelivepatch-608ec892541e7a70b18566c3a2084989b7621573.tar.gz
elivepatch-608ec892541e7a70b18566c3a2084989b7621573.tar.bz2
elivepatch-608ec892541e7a70b18566c3a2084989b7621573.zip
tempdir dosen't work from root
-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: