[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Properly expand the home directory to that of the user running ooniprobe.
commit bd56669bb78bd6d248492adb16bee719a201a4d3
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Wed Feb 5 13:46:32 2014 +0100
Properly expand the home directory to that of the user running ooniprobe.
Previously when running ooniprobe under sudo you would not get the correct home
directory because $HOME was set to that of the user running sudo.
---
ooni/settings.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ooni/settings.py b/ooni/settings.py
index de24a76..c1071b9 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -1,6 +1,8 @@
import os
import sys
import yaml
+import getpass
+
from shutil import copyfile
from os.path import abspath, expanduser
@@ -11,6 +13,7 @@ from ooni.utils import Storage
class OConfig(object):
def __init__(self):
+ self.current_user = getpass.getuser()
self.global_options = {}
self.reports = Storage()
self.scapyFactory = None
@@ -39,7 +42,7 @@ class OConfig(object):
self.nettest_directory = abspath(os.path.join(__file__, '..', 'nettests'))
- self.ooni_home = os.path.join(expanduser('~'), '.ooni')
+ self.ooni_home = os.path.join(expanduser('~'+self.current_user), '.ooni')
self.inputs_directory = os.path.join(self.ooni_home, 'inputs')
self.decks_directory = os.path.join(self.ooni_home, 'decks')
self.reports_directory = os.path.join(self.ooni_home, 'reports')
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits