diff --git a/plinth/modules/enabled/apps b/data/etc/plinth/modules-enabled/apps similarity index 100% rename from plinth/modules/enabled/apps rename to data/etc/plinth/modules-enabled/apps diff --git a/plinth/modules/enabled/config b/data/etc/plinth/modules-enabled/config similarity index 100% rename from plinth/modules/enabled/config rename to data/etc/plinth/modules-enabled/config diff --git a/plinth/modules/enabled/diagnostics b/data/etc/plinth/modules-enabled/diagnostics similarity index 100% rename from plinth/modules/enabled/diagnostics rename to data/etc/plinth/modules-enabled/diagnostics diff --git a/plinth/modules/enabled/expert_mode b/data/etc/plinth/modules-enabled/expert_mode similarity index 100% rename from plinth/modules/enabled/expert_mode rename to data/etc/plinth/modules-enabled/expert_mode diff --git a/plinth/modules/enabled/firewall b/data/etc/plinth/modules-enabled/firewall similarity index 100% rename from plinth/modules/enabled/firewall rename to data/etc/plinth/modules-enabled/firewall diff --git a/plinth/modules/enabled/first_boot b/data/etc/plinth/modules-enabled/first_boot similarity index 100% rename from plinth/modules/enabled/first_boot rename to data/etc/plinth/modules-enabled/first_boot diff --git a/plinth/modules/enabled/help b/data/etc/plinth/modules-enabled/help similarity index 100% rename from plinth/modules/enabled/help rename to data/etc/plinth/modules-enabled/help diff --git a/plinth/modules/enabled/lib b/data/etc/plinth/modules-enabled/lib similarity index 100% rename from plinth/modules/enabled/lib rename to data/etc/plinth/modules-enabled/lib diff --git a/plinth/modules/enabled/owncloud b/data/etc/plinth/modules-enabled/owncloud similarity index 100% rename from plinth/modules/enabled/owncloud rename to data/etc/plinth/modules-enabled/owncloud diff --git a/plinth/modules/enabled/packages b/data/etc/plinth/modules-enabled/packages similarity index 100% rename from plinth/modules/enabled/packages rename to data/etc/plinth/modules-enabled/packages diff --git a/plinth/modules/enabled/pagekite b/data/etc/plinth/modules-enabled/pagekite similarity index 100% rename from plinth/modules/enabled/pagekite rename to data/etc/plinth/modules-enabled/pagekite diff --git a/plinth/modules/enabled/system b/data/etc/plinth/modules-enabled/system similarity index 100% rename from plinth/modules/enabled/system rename to data/etc/plinth/modules-enabled/system diff --git a/plinth/modules/enabled/tor b/data/etc/plinth/modules-enabled/tor similarity index 100% rename from plinth/modules/enabled/tor rename to data/etc/plinth/modules-enabled/tor diff --git a/plinth/modules/enabled/users b/data/etc/plinth/modules-enabled/users similarity index 100% rename from plinth/modules/enabled/users rename to data/etc/plinth/modules-enabled/users diff --git a/plinth/modules/enabled/xmpp b/data/etc/plinth/modules-enabled/xmpp similarity index 100% rename from plinth/modules/enabled/xmpp rename to data/etc/plinth/modules-enabled/xmpp diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config index 297f22730..4b7c88616 100644 --- a/data/etc/plinth/plinth.config +++ b/data/etc/plinth/plinth.config @@ -5,6 +5,7 @@ box_name = FreedomBox [Path] # directory locations file_root = /usr/share/plinth +config_dir = /etc/plinth data_dir = /var/lib/plinth log_dir = /var/log/plinth pid_dir = /var/run diff --git a/plinth.config b/plinth.config index 76979e838..718dd9411 100644 --- a/plinth.config +++ b/plinth.config @@ -5,6 +5,7 @@ box_name = FreedomBox [Path] # directory locations file_root = %(root)s +config_dir = %(file_root)s/data/etc/plinth data_dir = %(file_root)s/data/var/lib/plinth log_dir = %(file_root)s/data/var/log/plinth pid_dir = %(file_root)s/data/var/run diff --git a/plinth/cfg.py b/plinth/cfg.py index cbe47d897..c39d6cc61 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -7,6 +7,7 @@ product_name = None box_name = None root = None file_root = None +config_dir = None data_dir = None store_file = None actions_dir = None @@ -48,6 +49,7 @@ def read(): ('Name', 'box_name'), ('Path', 'root'), ('Path', 'file_root'), + ('Path', 'config_dir'), ('Path', 'data_dir'), ('Path', 'store_file'), ('Path', 'actions_dir'), diff --git a/plinth/module_loader.py b/plinth/module_loader.py index 78d610176..70ea7f491 100644 --- a/plinth/module_loader.py +++ b/plinth/module_loader.py @@ -41,8 +41,8 @@ def load_modules(): pre_module_loading.send_robust(sender="module_loader") module_names = [] modules = {} - directory = os.path.dirname(os.path.abspath(__file__)) - for name in os.listdir(os.path.join(directory, 'modules', 'enabled')): + module_directory = os.path.join(cfg.config_dir, 'modules-enabled') + for name in os.listdir(module_directory): full_name = 'plinth.modules.{module}'.format(module=name) LOGGER.info('Importing %s', full_name) @@ -144,7 +144,8 @@ def get_template_directories(): core_directory = os.path.join(directory, 'templates') directories = set((core_directory,)) - for name in os.listdir(os.path.join(directory, 'modules', 'enabled')): + module_directory = os.path.join(cfg.config_dir, 'modules-enabled') + for name in os.listdir(module_directory): directories.add(os.path.join(directory, 'modules', name, 'templates')) return directories