commit 98259a39aec8826f32ce83aef1f85d8e1b5880ac Author: aagbsn aagbsn@extc.org Date: Sun Oct 26 13:29:09 2014 +0000
Check for system-config globally, use /var/lib/ooni --- ooni/resources/__init__.py | 8 ++++---- ooni/settings.py | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ooni/resources/__init__.py b/ooni/resources/__init__.py index 7297be5..4e60c78 100644 --- a/ooni/resources/__init__.py +++ b/ooni/resources/__init__.py @@ -7,10 +7,10 @@ from ooni.deckgen.processors import citizenlab_test_lists from ooni.deckgen.processors import namebench_dns_servers
# Use the system configuration if no user configuration exists -if not os.path.isfile(config.config_file) \ - and os.path.isfile('/etc/ooniprobe.conf'): - config.global_options['configfile'] = '/etc/ooniprobe.conf' - config.set_paths(ooni_home=config.advanced.data_dir) +#if not os.path.isfile(config.config_file) \ +# and os.path.isfile('/etc/ooniprobe.conf'): +# config.global_options['configfile'] = '/etc/ooniprobe.conf' +# config.set_paths(ooni_home=config.advanced.data_dir) config.read_config_file()
__version__ = "0.0.1" diff --git a/ooni/settings.py b/ooni/settings.py index bc3d2e5..342ec4e 100644 --- a/ooni/settings.py +++ b/ooni/settings.py @@ -45,7 +45,7 @@ class OConfig(object): elif hasattr(sys, 'real_prefix'): data_directory = os.path.abspath(os.path.join(sys.prefix, 'share', 'ooni')) elif not os.path.exists(data_directory): - data_directory = '/usr/share/ooni/' + data_directory = '/var/lib/ooni/'
return data_directory
@@ -94,7 +94,7 @@ class OConfig(object): def _create_config_file(self): target_config_file = self.config_file print "Creating it for you in '%s'." % target_config_file - usr_share_path = '/usr/share' + usr_share_path = '/var/lib/ooni' if hasattr(sys, 'real_prefix'): usr_share_path = os.path.abspath(os.path.join(sys.prefix, 'share')) sample_config_file = os.path.join(self.data_directory, @@ -180,3 +180,7 @@ class OConfig(object): self.log_incoherences(incoherent)
config = OConfig() +if not os.path.isfile(config.config_file) \ + and os.path.isfile('/etc/ooniprobe.conf'): + config.global_options['configfile'] = '/etc/ooniprobe.conf' + config.set_paths(ooni_home=config.advanced.data_dir)