From 90f1b52f49552252302cfcdc6cff4f45438a3c44 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 7 Jul 2014 17:36:49 +0200 Subject: [PATCH 01/42] Fix and generalize generating TODO list from source files --- doc/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index aa6ae989a..d66ddd3db 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -8,7 +8,8 @@ PDFLATEX=pdflatex # complete manual: SOURCES=README.mdwn INSTALL.mdwn themes.mdwn hacking.mdwn TODO.mdwn modules.mdwn scripts.mdwn security.mdwn faq.mdwn COPYING.mdwn colophon.mdwn OTHER= -TODO_SOURCES=$(patsubst TODO.mdwn,,$(SOURCES)) +PYTHON_SOURCES:=$(shell find .. -name \*.py) +TODO_SOURCES=$(patsubst TODO.mdwn,,$(SOURCES)) $(PYTHON_SOURCES) MAN_SOURCES=$(patsubst COPYING.mdwn,copyright_notice00,$(SOURCES)) NEWLINE_SOURCES=$(patsubst %,% oneline.txt,$(SOURCES)) @@ -41,7 +42,7 @@ $(SOURCES): @rm -f $@ @ln -s ../$(patsubst %.mdwn,%,$@) $@ -../TODO : $(TODO_SOURCES) ../*.py ../modules/*.py ../Makefile Makefile +../TODO : $(TODO_SOURCES) ../Makefile Makefile grep -ro --exclude=.git* --exclude=plinth.1 --exclude=*.tex --exclude=*.html \ --exclude=README.mdwn --exclude=INSTALL.mdwn \ --exclude=TODO.mdwn --exclude=COPYING.mdwn \ From eaacd3864bc82dad6f3e79d1bf8bb8bb7d499a48 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 7 Jul 2014 18:12:04 +0200 Subject: [PATCH 02/42] Remove license text for licenses no longer used --- COPYING | 60 --------------------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/COPYING b/COPYING index dc63b35dc..745262de3 100644 --- a/COPYING +++ b/COPYING @@ -1199,63 +1199,3 @@ recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. -## FileDict License. - -Copyright (c) 2009, Erez -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of the nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -## Cherrpy License - -Copyright (c) 2002-2008, CherryPy Team (team@cherrypy.org) -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the CherryPy Team nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 65fa648d9f24cc7d3500ad2a3a4c8e2540464f3e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 8 Jul 2014 13:14:30 +0200 Subject: [PATCH 03/42] Reorganize python sources into 'plinth' package --- plinth => bin/plinth | 0 {modules => plinth}/__init__.py | 0 plinth.py => plinth/__main__.py | 10 +++++----- actions.py => plinth/actions.py | 0 cfg.py => plinth/cfg.py | 1 + .../context_processors.py | 0 errors.py => plinth/errors.py | 0 menu.py => plinth/menu.py | 0 module_loader.py => plinth/module_loader.py | 11 ++++++----- plinth/modules/__init__.py | 0 {modules => plinth/modules}/apps/__init__.py | 0 {modules => plinth/modules}/apps/apps.py | 2 +- .../modules}/apps/templates/apps.html | 0 {modules => plinth/modules}/apps/urls.py | 2 +- {modules => plinth/modules}/config/__init__.py | 0 {modules => plinth/modules}/config/config.py | 6 +++--- .../modules}/config/templates/config.html | 0 {modules => plinth/modules}/config/urls.py | 2 +- {modules => plinth/modules}/diagnostics/__init__.py | 0 .../modules}/diagnostics/diagnostics.py | 6 +++--- .../modules}/diagnostics/templates/diagnostics.html | 0 .../diagnostics/templates/diagnostics_test.html | 0 {modules => plinth/modules}/diagnostics/urls.py | 2 +- {modules => plinth/modules}/enabled/apps | 0 {modules => plinth/modules}/enabled/config | 0 {modules => plinth/modules}/enabled/diagnostics | 0 {modules => plinth/modules}/enabled/expert_mode | 0 {modules => plinth/modules}/enabled/firewall | 0 {modules => plinth/modules}/enabled/first_boot | 0 {modules => plinth/modules}/enabled/help | 0 {modules => plinth/modules}/enabled/lib | 0 {modules => plinth/modules}/enabled/owncloud | 0 {modules => plinth/modules}/enabled/packages | 0 {modules => plinth/modules}/enabled/pagekite | 0 {modules => plinth/modules}/enabled/system | 0 {modules => plinth/modules}/enabled/tor | 0 {modules => plinth/modules}/enabled/users | 0 {modules => plinth/modules}/enabled/xmpp | 0 {modules => plinth/modules}/expert_mode/__init__.py | 0 .../modules}/expert_mode/expert_mode.py | 4 ++-- .../modules}/expert_mode/templates/expert_mode.html | 0 {modules => plinth/modules}/expert_mode/urls.py | 2 +- {modules => plinth/modules}/firewall/__init__.py | 0 {modules => plinth/modules}/firewall/firewall.py | 6 +++--- .../modules}/firewall/templates/firewall.html | 0 {modules => plinth/modules}/firewall/urls.py | 2 +- {modules => plinth/modules}/first_boot/__init__.py | 0 .../modules}/first_boot/first_boot.py | 6 +++--- .../modules}/first_boot/middleware.py | 0 .../first_boot/templates/firstboot_sidebar.html | 0 .../first_boot/templates/firstboot_state0.html | 0 .../first_boot/templates/firstboot_state1.html | 0 {modules => plinth/modules}/first_boot/urls.py | 2 +- {modules => plinth/modules}/help/__init__.py | 0 {modules => plinth/modules}/help/help.py | 2 +- .../modules}/help/templates/about.html | 0 .../modules}/help/templates/help.html | 0 {modules => plinth/modules}/help/urls.py | 2 +- {modules => plinth/modules}/lib/__init__.py | 0 {modules => plinth/modules}/lib/auth.py | 0 {modules => plinth/modules}/lib/urls.py | 0 {modules => plinth/modules}/owncloud/__init__.py | 0 {modules => plinth/modules}/owncloud/owncloud.py | 6 +++--- .../modules}/owncloud/templates/owncloud.html | 0 {modules => plinth/modules}/owncloud/urls.py | 2 +- {modules => plinth/modules}/packages/__init__.py | 0 {modules => plinth/modules}/packages/packages.py | 4 ++-- .../modules}/packages/templates/packages.html | 0 {modules => plinth/modules}/packages/urls.py | 6 +++--- {modules => plinth/modules}/pagekite/__init__.py | 0 {modules => plinth/modules}/pagekite/pagekite.py | 4 ++-- .../pagekite/templates/pagekite_configure.html | 0 .../pagekite/templates/pagekite_introduction.html | 0 {modules => plinth/modules}/pagekite/urls.py | 2 +- {modules => plinth/modules}/santiago/__init__.py | 0 {modules => plinth/modules}/santiago/santiago.py | 0 {modules => plinth/modules}/system/__init__.py | 0 {modules => plinth/modules}/system/system.py | 2 +- .../modules}/system/templates/system.html | 0 {modules => plinth/modules}/system/urls.py | 2 +- {modules => plinth/modules}/tor/__init__.py | 0 {modules => plinth/modules}/tor/templates/tor.html | 0 {modules => plinth/modules}/tor/tor.py | 4 ++-- {modules => plinth/modules}/tor/urls.py | 2 +- {modules => plinth/modules}/users/__init__.py | 0 .../modules}/users/templates/users_add.html | 0 .../modules}/users/templates/users_edit.html | 0 {modules => plinth/modules}/users/urls.py | 4 ++-- {modules => plinth/modules}/users/users.py | 4 ++-- {modules => plinth/modules}/xmpp/__init__.py | 0 .../modules}/xmpp/templates/xmpp_configure.html | 0 .../modules}/xmpp/templates/xmpp_register.html | 0 {modules => plinth/modules}/xmpp/urls.py | 4 ++-- {modules => plinth/modules}/xmpp/xmpp.py | 6 +++--- service.py => plinth/service.py | 0 {templates => plinth/templates}/404.html | 0 {templates => plinth/templates}/500.html | 0 {templates => plinth/templates}/base.html | 0 {templates => plinth/templates}/form.html | 0 {templates => plinth/templates}/login.html | 0 {templates => plinth/templates}/menu.html | 0 {templates => plinth/templates}/menu_block.html | 0 {templates => plinth/templates}/messages.html | 0 plinth/tests/__init__.py | 0 {tests => plinth/tests}/actions_test.py | 0 {tests => plinth/tests}/testdata/users.sqlite3 | Bin urls.py => plinth/urls.py | 4 ++-- util.py => plinth/util.py | 0 views.py => plinth/views.py | 0 109 files changed, 63 insertions(+), 61 deletions(-) rename plinth => bin/plinth (100%) rename {modules => plinth}/__init__.py (100%) rename plinth.py => plinth/__main__.py (97%) mode change 100755 => 100644 rename actions.py => plinth/actions.py (100%) rename cfg.py => plinth/cfg.py (97%) rename context_processors.py => plinth/context_processors.py (100%) rename errors.py => plinth/errors.py (100%) rename menu.py => plinth/menu.py (100%) rename module_loader.py => plinth/module_loader.py (92%) create mode 100644 plinth/modules/__init__.py rename {modules => plinth/modules}/apps/__init__.py (100%) rename {modules => plinth/modules}/apps/apps.py (93%) rename {modules => plinth/modules}/apps/templates/apps.html (100%) rename {modules => plinth/modules}/apps/urls.py (96%) rename {modules => plinth/modules}/config/__init__.py (100%) rename {modules => plinth/modules}/config/config.py (98%) rename {modules => plinth/modules}/config/templates/config.html (100%) rename {modules => plinth/modules}/config/urls.py (96%) rename {modules => plinth/modules}/diagnostics/__init__.py (100%) rename {modules => plinth/modules}/diagnostics/diagnostics.py (95%) rename {modules => plinth/modules}/diagnostics/templates/diagnostics.html (100%) rename {modules => plinth/modules}/diagnostics/templates/diagnostics_test.html (100%) rename {modules => plinth/modules}/diagnostics/urls.py (95%) rename {modules => plinth/modules}/enabled/apps (100%) rename {modules => plinth/modules}/enabled/config (100%) rename {modules => plinth/modules}/enabled/diagnostics (100%) rename {modules => plinth/modules}/enabled/expert_mode (100%) rename {modules => plinth/modules}/enabled/firewall (100%) rename {modules => plinth/modules}/enabled/first_boot (100%) rename {modules => plinth/modules}/enabled/help (100%) rename {modules => plinth/modules}/enabled/lib (100%) rename {modules => plinth/modules}/enabled/owncloud (100%) rename {modules => plinth/modules}/enabled/packages (100%) rename {modules => plinth/modules}/enabled/pagekite (100%) rename {modules => plinth/modules}/enabled/system (100%) rename {modules => plinth/modules}/enabled/tor (100%) rename {modules => plinth/modules}/enabled/users (100%) rename {modules => plinth/modules}/enabled/xmpp (100%) rename {modules => plinth/modules}/expert_mode/__init__.py (100%) rename {modules => plinth/modules}/expert_mode/expert_mode.py (96%) rename {modules => plinth/modules}/expert_mode/templates/expert_mode.html (100%) rename {modules => plinth/modules}/expert_mode/urls.py (95%) rename {modules => plinth/modules}/firewall/__init__.py (100%) rename {modules => plinth/modules}/firewall/firewall.py (98%) rename {modules => plinth/modules}/firewall/templates/firewall.html (100%) rename {modules => plinth/modules}/firewall/urls.py (95%) rename {modules => plinth/modules}/first_boot/__init__.py (100%) rename {modules => plinth/modules}/first_boot/first_boot.py (98%) rename {modules => plinth/modules}/first_boot/middleware.py (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_sidebar.html (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_state0.html (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_state1.html (100%) rename {modules => plinth/modules}/first_boot/urls.py (95%) rename {modules => plinth/modules}/help/__init__.py (100%) rename {modules => plinth/modules}/help/help.py (98%) rename {modules => plinth/modules}/help/templates/about.html (100%) rename {modules => plinth/modules}/help/templates/help.html (100%) rename {modules => plinth/modules}/help/urls.py (97%) rename {modules => plinth/modules}/lib/__init__.py (100%) rename {modules => plinth/modules}/lib/auth.py (100%) rename {modules => plinth/modules}/lib/urls.py (100%) rename {modules => plinth/modules}/owncloud/__init__.py (100%) rename {modules => plinth/modules}/owncloud/owncloud.py (96%) rename {modules => plinth/modules}/owncloud/templates/owncloud.html (100%) rename {modules => plinth/modules}/owncloud/urls.py (95%) rename {modules => plinth/modules}/packages/__init__.py (100%) rename {modules => plinth/modules}/packages/packages.py (98%) rename {modules => plinth/modules}/packages/templates/packages.html (100%) rename {modules => plinth/modules}/packages/urls.py (89%) rename {modules => plinth/modules}/pagekite/__init__.py (100%) rename {modules => plinth/modules}/pagekite/pagekite.py (99%) rename {modules => plinth/modules}/pagekite/templates/pagekite_configure.html (100%) rename {modules => plinth/modules}/pagekite/templates/pagekite_introduction.html (100%) rename {modules => plinth/modules}/pagekite/urls.py (95%) rename {modules => plinth/modules}/santiago/__init__.py (100%) rename {modules => plinth/modules}/santiago/santiago.py (100%) rename {modules => plinth/modules}/system/__init__.py (100%) rename {modules => plinth/modules}/system/system.py (94%) rename {modules => plinth/modules}/system/templates/system.html (100%) rename {modules => plinth/modules}/system/urls.py (96%) rename {modules => plinth/modules}/tor/__init__.py (100%) rename {modules => plinth/modules}/tor/templates/tor.html (100%) rename {modules => plinth/modules}/tor/tor.py (96%) rename {modules => plinth/modules}/tor/urls.py (96%) rename {modules => plinth/modules}/users/__init__.py (100%) rename {modules => plinth/modules}/users/templates/users_add.html (100%) rename {modules => plinth/modules}/users/templates/users_edit.html (100%) rename {modules => plinth/modules}/users/urls.py (96%) rename {modules => plinth/modules}/users/users.py (98%) rename {modules => plinth/modules}/xmpp/__init__.py (100%) rename {modules => plinth/modules}/xmpp/templates/xmpp_configure.html (100%) rename {modules => plinth/modules}/xmpp/templates/xmpp_register.html (100%) rename {modules => plinth/modules}/xmpp/urls.py (96%) rename {modules => plinth/modules}/xmpp/xmpp.py (98%) rename service.py => plinth/service.py (100%) rename {templates => plinth/templates}/404.html (100%) rename {templates => plinth/templates}/500.html (100%) rename {templates => plinth/templates}/base.html (100%) rename {templates => plinth/templates}/form.html (100%) rename {templates => plinth/templates}/login.html (100%) rename {templates => plinth/templates}/menu.html (100%) rename {templates => plinth/templates}/menu_block.html (100%) rename {templates => plinth/templates}/messages.html (100%) create mode 100644 plinth/tests/__init__.py rename {tests => plinth/tests}/actions_test.py (100%) rename {tests => plinth/tests}/testdata/users.sqlite3 (100%) rename urls.py => plinth/urls.py (97%) rename util.py => plinth/util.py (100%) rename views.py => plinth/views.py (100%) diff --git a/plinth b/bin/plinth similarity index 100% rename from plinth rename to bin/plinth diff --git a/modules/__init__.py b/plinth/__init__.py similarity index 100% rename from modules/__init__.py rename to plinth/__init__.py diff --git a/plinth.py b/plinth/__main__.py old mode 100755 new mode 100644 similarity index 97% rename from plinth.py rename to plinth/__main__.py index 969e0b9b4..25a67d652 --- a/plinth.py +++ b/plinth/__main__.py @@ -13,9 +13,9 @@ import cherrypy from cherrypy import _cpserver from cherrypy.process.plugins import Daemonizer -import cfg -import module_loader -import service +from plinth import cfg +from plinth import module_loader +from plinth import service __version__ = "0.2.14" __author__ = "James Vasile" @@ -141,7 +141,7 @@ def configure_django(): 'django.core.context_processors.static', 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', - 'context_processors.common'] + 'plinth.context_processors.common'] logging_configuration = { 'version': 1, @@ -198,7 +198,7 @@ def configure_django(): 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'modules.first_boot.middleware.FirstBootMiddleware', ), - ROOT_URLCONF='urls', + ROOT_URLCONF='plinth.urls', SESSION_ENGINE='django.contrib.sessions.backends.file', SESSION_FILE_PATH=sessions_directory, STATIC_URL=cfg.server_dir + '/static/', diff --git a/actions.py b/plinth/actions.py similarity index 100% rename from actions.py rename to plinth/actions.py diff --git a/cfg.py b/plinth/cfg.py similarity index 97% rename from cfg.py rename to plinth/cfg.py index 4844393c4..3f8b687b5 100644 --- a/cfg.py +++ b/plinth/cfg.py @@ -28,6 +28,7 @@ main_menu = Menu() def read(): """Read configuration""" directory = os.path.dirname(os.path.realpath(__file__)) + directory = os.path.join(directory, '..') parser = SafeConfigParser( defaults={ 'root': directory, diff --git a/context_processors.py b/plinth/context_processors.py similarity index 100% rename from context_processors.py rename to plinth/context_processors.py diff --git a/errors.py b/plinth/errors.py similarity index 100% rename from errors.py rename to plinth/errors.py diff --git a/menu.py b/plinth/menu.py similarity index 100% rename from menu.py rename to plinth/menu.py diff --git a/module_loader.py b/plinth/module_loader.py similarity index 92% rename from module_loader.py rename to plinth/module_loader.py index e14dd4551..b552d2260 100644 --- a/module_loader.py +++ b/plinth/module_loader.py @@ -24,8 +24,8 @@ import importlib import logging import os -import urls -import cfg +from plinth import cfg +from plinth import urls LOGGER = logging.getLogger(__name__) @@ -39,8 +39,9 @@ def load_modules(): """ module_names = [] modules = {} - for name in os.listdir('modules/enabled'): - full_name = 'modules.{module}'.format(module=name) + directory = os.path.dirname(os.path.abspath(__file__)) + for name in os.listdir(os.path.join(directory, 'modules', 'enabled')): + full_name = 'plinth.modules.{module}'.format(module=name) LOGGER.info('Importing %s', full_name) try: @@ -139,7 +140,7 @@ def get_template_directories(): core_directory = os.path.join(directory, 'templates') directories = set((core_directory,)) - for name in os.listdir('modules/enabled'): + for name in os.listdir(os.path.join(directory, 'modules', 'enabled')): directories.add(os.path.join(directory, 'modules', name, 'templates')) return directories diff --git a/plinth/modules/__init__.py b/plinth/modules/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/modules/apps/__init__.py b/plinth/modules/apps/__init__.py similarity index 100% rename from modules/apps/__init__.py rename to plinth/modules/apps/__init__.py diff --git a/modules/apps/apps.py b/plinth/modules/apps/apps.py similarity index 93% rename from modules/apps/apps.py rename to plinth/modules/apps/apps.py index 206ae5da0..69cc1b90e 100644 --- a/modules/apps/apps.py +++ b/plinth/modules/apps/apps.py @@ -1,7 +1,7 @@ from django.template.response import TemplateResponse from gettext import gettext as _ -import cfg +from plinth import cfg def init(): diff --git a/modules/apps/templates/apps.html b/plinth/modules/apps/templates/apps.html similarity index 100% rename from modules/apps/templates/apps.html rename to plinth/modules/apps/templates/apps.html diff --git a/modules/apps/urls.py b/plinth/modules/apps/urls.py similarity index 96% rename from modules/apps/urls.py rename to plinth/modules/apps/urls.py index b47f44cde..db2b9e547 100644 --- a/modules/apps/urls.py +++ b/plinth/modules/apps/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.apps.apps', + 'plinth.modules.apps.apps', url(r'^apps/$', 'index', name='index') ) diff --git a/modules/config/__init__.py b/plinth/modules/config/__init__.py similarity index 100% rename from modules/config/__init__.py rename to plinth/modules/config/__init__.py diff --git a/modules/config/config.py b/plinth/modules/config/config.py similarity index 98% rename from modules/config/config.py rename to plinth/modules/config/config.py index 1d11a9008..5c88424cd 100644 --- a/modules/config/config.py +++ b/plinth/modules/config/config.py @@ -29,9 +29,9 @@ import logging import re import socket -import actions -import cfg -import util +from plinth import actions +from plinth import cfg +from plinth import util LOGGER = logging.getLogger(__name__) diff --git a/modules/config/templates/config.html b/plinth/modules/config/templates/config.html similarity index 100% rename from modules/config/templates/config.html rename to plinth/modules/config/templates/config.html diff --git a/modules/config/urls.py b/plinth/modules/config/urls.py similarity index 96% rename from modules/config/urls.py rename to plinth/modules/config/urls.py index e80f518dc..a66f593d0 100644 --- a/modules/config/urls.py +++ b/plinth/modules/config/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.config.config', + 'plinth.modules.config.config', url(r'^sys/config/$', 'index', name='index'), ) diff --git a/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py similarity index 100% rename from modules/diagnostics/__init__.py rename to plinth/modules/diagnostics/__init__.py diff --git a/modules/diagnostics/diagnostics.py b/plinth/modules/diagnostics/diagnostics.py similarity index 95% rename from modules/diagnostics/diagnostics.py rename to plinth/modules/diagnostics/diagnostics.py index 32b66310c..295f0efd4 100644 --- a/modules/diagnostics/diagnostics.py +++ b/plinth/modules/diagnostics/diagnostics.py @@ -23,9 +23,9 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg -from errors import ActionError +from plinth import actions +from plinth import cfg +from plinth.errors import ActionError def init(): diff --git a/modules/diagnostics/templates/diagnostics.html b/plinth/modules/diagnostics/templates/diagnostics.html similarity index 100% rename from modules/diagnostics/templates/diagnostics.html rename to plinth/modules/diagnostics/templates/diagnostics.html diff --git a/modules/diagnostics/templates/diagnostics_test.html b/plinth/modules/diagnostics/templates/diagnostics_test.html similarity index 100% rename from modules/diagnostics/templates/diagnostics_test.html rename to plinth/modules/diagnostics/templates/diagnostics_test.html diff --git a/modules/diagnostics/urls.py b/plinth/modules/diagnostics/urls.py similarity index 95% rename from modules/diagnostics/urls.py rename to plinth/modules/diagnostics/urls.py index 4ed974f9b..c1797c716 100644 --- a/modules/diagnostics/urls.py +++ b/plinth/modules/diagnostics/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.diagnostics.diagnostics', + 'plinth.modules.diagnostics.diagnostics', url(r'^sys/diagnostics/$', 'index', name='index'), url(r'^sys/diagnostics/test/$', 'test', name='test'), ) diff --git a/modules/enabled/apps b/plinth/modules/enabled/apps similarity index 100% rename from modules/enabled/apps rename to plinth/modules/enabled/apps diff --git a/modules/enabled/config b/plinth/modules/enabled/config similarity index 100% rename from modules/enabled/config rename to plinth/modules/enabled/config diff --git a/modules/enabled/diagnostics b/plinth/modules/enabled/diagnostics similarity index 100% rename from modules/enabled/diagnostics rename to plinth/modules/enabled/diagnostics diff --git a/modules/enabled/expert_mode b/plinth/modules/enabled/expert_mode similarity index 100% rename from modules/enabled/expert_mode rename to plinth/modules/enabled/expert_mode diff --git a/modules/enabled/firewall b/plinth/modules/enabled/firewall similarity index 100% rename from modules/enabled/firewall rename to plinth/modules/enabled/firewall diff --git a/modules/enabled/first_boot b/plinth/modules/enabled/first_boot similarity index 100% rename from modules/enabled/first_boot rename to plinth/modules/enabled/first_boot diff --git a/modules/enabled/help b/plinth/modules/enabled/help similarity index 100% rename from modules/enabled/help rename to plinth/modules/enabled/help diff --git a/modules/enabled/lib b/plinth/modules/enabled/lib similarity index 100% rename from modules/enabled/lib rename to plinth/modules/enabled/lib diff --git a/modules/enabled/owncloud b/plinth/modules/enabled/owncloud similarity index 100% rename from modules/enabled/owncloud rename to plinth/modules/enabled/owncloud diff --git a/modules/enabled/packages b/plinth/modules/enabled/packages similarity index 100% rename from modules/enabled/packages rename to plinth/modules/enabled/packages diff --git a/modules/enabled/pagekite b/plinth/modules/enabled/pagekite similarity index 100% rename from modules/enabled/pagekite rename to plinth/modules/enabled/pagekite diff --git a/modules/enabled/system b/plinth/modules/enabled/system similarity index 100% rename from modules/enabled/system rename to plinth/modules/enabled/system diff --git a/modules/enabled/tor b/plinth/modules/enabled/tor similarity index 100% rename from modules/enabled/tor rename to plinth/modules/enabled/tor diff --git a/modules/enabled/users b/plinth/modules/enabled/users similarity index 100% rename from modules/enabled/users rename to plinth/modules/enabled/users diff --git a/modules/enabled/xmpp b/plinth/modules/enabled/xmpp similarity index 100% rename from modules/enabled/xmpp rename to plinth/modules/enabled/xmpp diff --git a/modules/expert_mode/__init__.py b/plinth/modules/expert_mode/__init__.py similarity index 100% rename from modules/expert_mode/__init__.py rename to plinth/modules/expert_mode/__init__.py diff --git a/modules/expert_mode/expert_mode.py b/plinth/modules/expert_mode/expert_mode.py similarity index 96% rename from modules/expert_mode/expert_mode.py rename to plinth/modules/expert_mode/expert_mode.py index 3ec98bb76..b55992fa9 100644 --- a/modules/expert_mode/expert_mode.py +++ b/plinth/modules/expert_mode/expert_mode.py @@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import cfg -from ..lib.auth import get_group +from plinth import cfg +from plinth.modules.lib.auth import get_group class ExpertsForm(forms.Form): # pylint: disable-msg=W0232 diff --git a/modules/expert_mode/templates/expert_mode.html b/plinth/modules/expert_mode/templates/expert_mode.html similarity index 100% rename from modules/expert_mode/templates/expert_mode.html rename to plinth/modules/expert_mode/templates/expert_mode.html diff --git a/modules/expert_mode/urls.py b/plinth/modules/expert_mode/urls.py similarity index 95% rename from modules/expert_mode/urls.py rename to plinth/modules/expert_mode/urls.py index ffb97da53..038f8fc30 100644 --- a/modules/expert_mode/urls.py +++ b/plinth/modules/expert_mode/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.expert_mode.expert_mode', + 'plinth.modules.expert_mode.expert_mode', url(r'^sys/expert/$', 'index', name='index'), ) diff --git a/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py similarity index 100% rename from modules/firewall/__init__.py rename to plinth/modules/firewall/__init__.py diff --git a/modules/firewall/firewall.py b/plinth/modules/firewall/firewall.py similarity index 98% rename from modules/firewall/firewall.py rename to plinth/modules/firewall/firewall.py index 760e980e6..5062488db 100644 --- a/modules/firewall/firewall.py +++ b/plinth/modules/firewall/firewall.py @@ -24,9 +24,9 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg -import service as service_module +from plinth import actions +from plinth import cfg +import plinth.service as service_module LOGGER = logging.getLogger(__name__) diff --git a/modules/firewall/templates/firewall.html b/plinth/modules/firewall/templates/firewall.html similarity index 100% rename from modules/firewall/templates/firewall.html rename to plinth/modules/firewall/templates/firewall.html diff --git a/modules/firewall/urls.py b/plinth/modules/firewall/urls.py similarity index 95% rename from modules/firewall/urls.py rename to plinth/modules/firewall/urls.py index be2f1494a..3d2da27b7 100644 --- a/modules/firewall/urls.py +++ b/plinth/modules/firewall/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.firewall.firewall', + 'plinth.modules.firewall.firewall', url(r'^sys/firewall/$', 'index', name='index') ) diff --git a/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py similarity index 100% rename from modules/first_boot/__init__.py rename to plinth/modules/first_boot/__init__.py diff --git a/modules/first_boot/first_boot.py b/plinth/modules/first_boot/first_boot.py similarity index 98% rename from modules/first_boot/first_boot.py rename to plinth/modules/first_boot/first_boot.py index f784c507b..748e7ff4b 100644 --- a/modules/first_boot/first_boot.py +++ b/plinth/modules/first_boot/first_boot.py @@ -26,10 +26,10 @@ from django.http.response import HttpResponseRedirect from django.template.response import TemplateResponse from gettext import gettext as _ -from ..lib.auth import add_user -from ..config import config +from plinth import cfg +from plinth.modules.config import config +from plinth.modules.lib.auth import add_user from withsqlite.withsqlite import sqlite_db -import cfg ## TODO: flesh out these tests values diff --git a/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py similarity index 100% rename from modules/first_boot/middleware.py rename to plinth/modules/first_boot/middleware.py diff --git a/modules/first_boot/templates/firstboot_sidebar.html b/plinth/modules/first_boot/templates/firstboot_sidebar.html similarity index 100% rename from modules/first_boot/templates/firstboot_sidebar.html rename to plinth/modules/first_boot/templates/firstboot_sidebar.html diff --git a/modules/first_boot/templates/firstboot_state0.html b/plinth/modules/first_boot/templates/firstboot_state0.html similarity index 100% rename from modules/first_boot/templates/firstboot_state0.html rename to plinth/modules/first_boot/templates/firstboot_state0.html diff --git a/modules/first_boot/templates/firstboot_state1.html b/plinth/modules/first_boot/templates/firstboot_state1.html similarity index 100% rename from modules/first_boot/templates/firstboot_state1.html rename to plinth/modules/first_boot/templates/firstboot_state1.html diff --git a/modules/first_boot/urls.py b/plinth/modules/first_boot/urls.py similarity index 95% rename from modules/first_boot/urls.py rename to plinth/modules/first_boot/urls.py index 68669e6e9..d16290dba 100644 --- a/modules/first_boot/urls.py +++ b/plinth/modules/first_boot/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.first_boot.first_boot', + 'plinth.modules.first_boot.first_boot', url(r'^firstboot/$', 'index', name='index'), url(r'^firstboot/state0/$', 'state0', name='state0'), url(r'^firstboot/state1/$', 'state1', name='state1') diff --git a/modules/help/__init__.py b/plinth/modules/help/__init__.py similarity index 100% rename from modules/help/__init__.py rename to plinth/modules/help/__init__.py diff --git a/modules/help/help.py b/plinth/modules/help/help.py similarity index 98% rename from modules/help/help.py rename to plinth/modules/help/help.py index 0d73e6df2..b3245dc89 100644 --- a/modules/help/help.py +++ b/plinth/modules/help/help.py @@ -3,7 +3,7 @@ from gettext import gettext as _ from django.http import Http404 from django.template.response import TemplateResponse -import cfg +from plinth import cfg def init(): diff --git a/modules/help/templates/about.html b/plinth/modules/help/templates/about.html similarity index 100% rename from modules/help/templates/about.html rename to plinth/modules/help/templates/about.html diff --git a/modules/help/templates/help.html b/plinth/modules/help/templates/help.html similarity index 100% rename from modules/help/templates/help.html rename to plinth/modules/help/templates/help.html diff --git a/modules/help/urls.py b/plinth/modules/help/urls.py similarity index 97% rename from modules/help/urls.py rename to plinth/modules/help/urls.py index 38adfc807..c43c6f5f5 100644 --- a/modules/help/urls.py +++ b/plinth/modules/help/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.help.help', + 'plinth.modules.help.help', # having two urls for one page is a hack to help the current url/menu # system highlight the correct menu item. Every submenu-item with the same # url prefix as the main-menu is highlighted automatically. diff --git a/modules/lib/__init__.py b/plinth/modules/lib/__init__.py similarity index 100% rename from modules/lib/__init__.py rename to plinth/modules/lib/__init__.py diff --git a/modules/lib/auth.py b/plinth/modules/lib/auth.py similarity index 100% rename from modules/lib/auth.py rename to plinth/modules/lib/auth.py diff --git a/modules/lib/urls.py b/plinth/modules/lib/urls.py similarity index 100% rename from modules/lib/urls.py rename to plinth/modules/lib/urls.py diff --git a/modules/owncloud/__init__.py b/plinth/modules/owncloud/__init__.py similarity index 100% rename from modules/owncloud/__init__.py rename to plinth/modules/owncloud/__init__.py diff --git a/modules/owncloud/owncloud.py b/plinth/modules/owncloud/owncloud.py similarity index 96% rename from modules/owncloud/owncloud.py rename to plinth/modules/owncloud/owncloud.py index 2949d5f89..217ac3221 100644 --- a/modules/owncloud/owncloud.py +++ b/plinth/modules/owncloud/owncloud.py @@ -4,9 +4,9 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg -import service +from plinth import actions +from plinth import cfg +from plinth import service SERVICE = None diff --git a/modules/owncloud/templates/owncloud.html b/plinth/modules/owncloud/templates/owncloud.html similarity index 100% rename from modules/owncloud/templates/owncloud.html rename to plinth/modules/owncloud/templates/owncloud.html diff --git a/modules/owncloud/urls.py b/plinth/modules/owncloud/urls.py similarity index 95% rename from modules/owncloud/urls.py rename to plinth/modules/owncloud/urls.py index faa23d43b..8882159ea 100644 --- a/modules/owncloud/urls.py +++ b/plinth/modules/owncloud/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.owncloud.owncloud', + 'plinth.modules.owncloud.owncloud', url(r'^apps/owncloud/$', 'index', name='index'), ) diff --git a/modules/packages/__init__.py b/plinth/modules/packages/__init__.py similarity index 100% rename from modules/packages/__init__.py rename to plinth/modules/packages/__init__.py diff --git a/modules/packages/packages.py b/plinth/modules/packages/packages.py similarity index 98% rename from modules/packages/packages.py rename to plinth/modules/packages/packages.py index ee4c52717..8fe4cf6dc 100644 --- a/modules/packages/packages.py +++ b/plinth/modules/packages/packages.py @@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg +from plinth import actions +from plinth import cfg def get_modules_available(): diff --git a/modules/packages/templates/packages.html b/plinth/modules/packages/templates/packages.html similarity index 100% rename from modules/packages/templates/packages.html rename to plinth/modules/packages/templates/packages.html diff --git a/modules/packages/urls.py b/plinth/modules/packages/urls.py similarity index 89% rename from modules/packages/urls.py rename to plinth/modules/packages/urls.py index 60faf35bf..6eaf99b04 100644 --- a/modules/packages/urls.py +++ b/plinth/modules/packages/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.packages.packages', - url(r'^sys/packages/$', 'index', name='index'), - ) + 'plinth.modules.packages.packages', + url(r'^sys/packages/$', 'index', name='index') +) diff --git a/modules/pagekite/__init__.py b/plinth/modules/pagekite/__init__.py similarity index 100% rename from modules/pagekite/__init__.py rename to plinth/modules/pagekite/__init__.py diff --git a/modules/pagekite/pagekite.py b/plinth/modules/pagekite/pagekite.py similarity index 99% rename from modules/pagekite/pagekite.py rename to plinth/modules/pagekite/pagekite.py index f6e90ced0..7e49ee029 100644 --- a/modules/pagekite/pagekite.py +++ b/plinth/modules/pagekite/pagekite.py @@ -30,8 +30,8 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg +from plinth import actions +from plinth import cfg LOGGER = logging.getLogger(__name__) diff --git a/modules/pagekite/templates/pagekite_configure.html b/plinth/modules/pagekite/templates/pagekite_configure.html similarity index 100% rename from modules/pagekite/templates/pagekite_configure.html rename to plinth/modules/pagekite/templates/pagekite_configure.html diff --git a/modules/pagekite/templates/pagekite_introduction.html b/plinth/modules/pagekite/templates/pagekite_introduction.html similarity index 100% rename from modules/pagekite/templates/pagekite_introduction.html rename to plinth/modules/pagekite/templates/pagekite_introduction.html diff --git a/modules/pagekite/urls.py b/plinth/modules/pagekite/urls.py similarity index 95% rename from modules/pagekite/urls.py rename to plinth/modules/pagekite/urls.py index 3db1d2f98..7fa6c9918 100644 --- a/modules/pagekite/urls.py +++ b/plinth/modules/pagekite/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.pagekite.pagekite', + 'plinth.modules.pagekite.pagekite', url(r'^apps/pagekite/$', 'index', name='index'), url(r'^apps/pagekite/configure/$', 'configure', name='configure'), ) diff --git a/modules/santiago/__init__.py b/plinth/modules/santiago/__init__.py similarity index 100% rename from modules/santiago/__init__.py rename to plinth/modules/santiago/__init__.py diff --git a/modules/santiago/santiago.py b/plinth/modules/santiago/santiago.py similarity index 100% rename from modules/santiago/santiago.py rename to plinth/modules/santiago/santiago.py diff --git a/modules/system/__init__.py b/plinth/modules/system/__init__.py similarity index 100% rename from modules/system/__init__.py rename to plinth/modules/system/__init__.py diff --git a/modules/system/system.py b/plinth/modules/system/system.py similarity index 94% rename from modules/system/system.py rename to plinth/modules/system/system.py index 961461983..24cad9fa7 100644 --- a/modules/system/system.py +++ b/plinth/modules/system/system.py @@ -1,7 +1,7 @@ from gettext import gettext as _ from django.template.response import TemplateResponse -import cfg +from plinth import cfg def init(): diff --git a/modules/system/templates/system.html b/plinth/modules/system/templates/system.html similarity index 100% rename from modules/system/templates/system.html rename to plinth/modules/system/templates/system.html diff --git a/modules/system/urls.py b/plinth/modules/system/urls.py similarity index 96% rename from modules/system/urls.py rename to plinth/modules/system/urls.py index 5982ce850..179556675 100644 --- a/modules/system/urls.py +++ b/plinth/modules/system/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.system.system', + 'plinth.modules.system.system', url(r'^sys/$', 'index', name='index'), ) diff --git a/modules/tor/__init__.py b/plinth/modules/tor/__init__.py similarity index 100% rename from modules/tor/__init__.py rename to plinth/modules/tor/__init__.py diff --git a/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html similarity index 100% rename from modules/tor/templates/tor.html rename to plinth/modules/tor/templates/tor.html diff --git a/modules/tor/tor.py b/plinth/modules/tor/tor.py similarity index 96% rename from modules/tor/tor.py rename to plinth/modules/tor/tor.py index 335250983..37ffd76cf 100644 --- a/modules/tor/tor.py +++ b/plinth/modules/tor/tor.py @@ -23,8 +23,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg +from plinth import actions +from plinth import cfg def init(): diff --git a/modules/tor/urls.py b/plinth/modules/tor/urls.py similarity index 96% rename from modules/tor/urls.py rename to plinth/modules/tor/urls.py index 4c13cb138..7962614f4 100644 --- a/modules/tor/urls.py +++ b/plinth/modules/tor/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.tor.tor', + 'plinth.modules.tor.tor', url(r'^apps/tor/$', 'index', name='index') ) diff --git a/modules/users/__init__.py b/plinth/modules/users/__init__.py similarity index 100% rename from modules/users/__init__.py rename to plinth/modules/users/__init__.py diff --git a/modules/users/templates/users_add.html b/plinth/modules/users/templates/users_add.html similarity index 100% rename from modules/users/templates/users_add.html rename to plinth/modules/users/templates/users_add.html diff --git a/modules/users/templates/users_edit.html b/plinth/modules/users/templates/users_edit.html similarity index 100% rename from modules/users/templates/users_edit.html rename to plinth/modules/users/templates/users_edit.html diff --git a/modules/users/urls.py b/plinth/modules/users/urls.py similarity index 96% rename from modules/users/urls.py rename to plinth/modules/users/urls.py index 0c46aa72e..0308837ec 100644 --- a/modules/users/urls.py +++ b/plinth/modules/users/urls.py @@ -23,8 +23,8 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.users.users', + 'plinth.modules.users.users', url(r'^sys/users/$', 'index', name='index'), url(r'^sys/users/add/$', 'add', name='add'), url(r'^sys/users/edit/$', 'edit', name='edit') - ) +) diff --git a/modules/users/users.py b/plinth/modules/users/users.py similarity index 98% rename from modules/users/users.py rename to plinth/modules/users/users.py index 5197b28ba..aef303970 100644 --- a/modules/users/users.py +++ b/plinth/modules/users/users.py @@ -10,8 +10,8 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import cfg -from ..lib.auth import add_user +from plinth import cfg +from plinth.modules.lib.auth import add_user LOGGER = logging.getLogger(__name__) diff --git a/modules/xmpp/__init__.py b/plinth/modules/xmpp/__init__.py similarity index 100% rename from modules/xmpp/__init__.py rename to plinth/modules/xmpp/__init__.py diff --git a/modules/xmpp/templates/xmpp_configure.html b/plinth/modules/xmpp/templates/xmpp_configure.html similarity index 100% rename from modules/xmpp/templates/xmpp_configure.html rename to plinth/modules/xmpp/templates/xmpp_configure.html diff --git a/modules/xmpp/templates/xmpp_register.html b/plinth/modules/xmpp/templates/xmpp_register.html similarity index 100% rename from modules/xmpp/templates/xmpp_register.html rename to plinth/modules/xmpp/templates/xmpp_register.html diff --git a/modules/xmpp/urls.py b/plinth/modules/xmpp/urls.py similarity index 96% rename from modules/xmpp/urls.py rename to plinth/modules/xmpp/urls.py index 050026d81..ee7a651dd 100644 --- a/modules/xmpp/urls.py +++ b/plinth/modules/xmpp/urls.py @@ -23,8 +23,8 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.xmpp.xmpp', + 'plinth.modules.xmpp.xmpp', url(r'^apps/xmpp/$', 'index', name='index'), url(r'^apps/xmpp/configure/$', 'configure', name='configure'), url(r'^apps/xmpp/register/$', 'register', name='register') - ) +) diff --git a/modules/xmpp/xmpp.py b/plinth/modules/xmpp/xmpp.py similarity index 98% rename from modules/xmpp/xmpp.py rename to plinth/modules/xmpp/xmpp.py index fb09eef94..ae7ef1afb 100644 --- a/modules/xmpp/xmpp.py +++ b/plinth/modules/xmpp/xmpp.py @@ -8,9 +8,9 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg -import service +from plinth import actions +from plinth import cfg +from plinth import service LOGGER = logging.getLogger(__name__) diff --git a/service.py b/plinth/service.py similarity index 100% rename from service.py rename to plinth/service.py diff --git a/templates/404.html b/plinth/templates/404.html similarity index 100% rename from templates/404.html rename to plinth/templates/404.html diff --git a/templates/500.html b/plinth/templates/500.html similarity index 100% rename from templates/500.html rename to plinth/templates/500.html diff --git a/templates/base.html b/plinth/templates/base.html similarity index 100% rename from templates/base.html rename to plinth/templates/base.html diff --git a/templates/form.html b/plinth/templates/form.html similarity index 100% rename from templates/form.html rename to plinth/templates/form.html diff --git a/templates/login.html b/plinth/templates/login.html similarity index 100% rename from templates/login.html rename to plinth/templates/login.html diff --git a/templates/menu.html b/plinth/templates/menu.html similarity index 100% rename from templates/menu.html rename to plinth/templates/menu.html diff --git a/templates/menu_block.html b/plinth/templates/menu_block.html similarity index 100% rename from templates/menu_block.html rename to plinth/templates/menu_block.html diff --git a/templates/messages.html b/plinth/templates/messages.html similarity index 100% rename from templates/messages.html rename to plinth/templates/messages.html diff --git a/plinth/tests/__init__.py b/plinth/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/actions_test.py b/plinth/tests/actions_test.py similarity index 100% rename from tests/actions_test.py rename to plinth/tests/actions_test.py diff --git a/tests/testdata/users.sqlite3 b/plinth/tests/testdata/users.sqlite3 similarity index 100% rename from tests/testdata/users.sqlite3 rename to plinth/tests/testdata/users.sqlite3 diff --git a/urls.py b/plinth/urls.py similarity index 97% rename from urls.py rename to plinth/urls.py index 73837133b..5ab1c866e 100644 --- a/urls.py +++ b/plinth/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'views', + 'plinth.views', url(r'^$', 'index', name='index') - ) +) diff --git a/util.py b/plinth/util.py similarity index 100% rename from util.py rename to plinth/util.py diff --git a/views.py b/plinth/views.py similarity index 100% rename from views.py rename to plinth/views.py From 7c60b79e89c3db436286b1e897d63634b35f3a2c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 15:14:41 +0530 Subject: [PATCH 04/42] Remove executable permissions on image files --- .../img/FreedomBox-logo-grayscale-negative.png | Bin .../img/FreedomBox-logo-grayscale-negative.svg | 0 themes/default/img/FreedomBox-logo-grayscale.png | Bin themes/default/img/FreedomBox-logo-grayscale.svg | 0 .../img/FreedomBox-logo-lineart-negative.png | Bin .../img/FreedomBox-logo-lineart-negative.svg | 0 themes/default/img/FreedomBox-logo-lineart.png | Bin themes/default/img/FreedomBox-logo-lineart.svg | 0 themes/default/img/FreedomBox-logo-standard.png | Bin themes/default/img/FreedomBox-logo-standard.svg | 0 10 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 themes/default/img/FreedomBox-logo-grayscale-negative.png mode change 100755 => 100644 themes/default/img/FreedomBox-logo-grayscale-negative.svg mode change 100755 => 100644 themes/default/img/FreedomBox-logo-grayscale.png mode change 100755 => 100644 themes/default/img/FreedomBox-logo-grayscale.svg mode change 100755 => 100644 themes/default/img/FreedomBox-logo-lineart-negative.png mode change 100755 => 100644 themes/default/img/FreedomBox-logo-lineart-negative.svg mode change 100755 => 100644 themes/default/img/FreedomBox-logo-lineart.png mode change 100755 => 100644 themes/default/img/FreedomBox-logo-lineart.svg mode change 100755 => 100644 themes/default/img/FreedomBox-logo-standard.png mode change 100755 => 100644 themes/default/img/FreedomBox-logo-standard.svg diff --git a/themes/default/img/FreedomBox-logo-grayscale-negative.png b/themes/default/img/FreedomBox-logo-grayscale-negative.png old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-grayscale-negative.svg b/themes/default/img/FreedomBox-logo-grayscale-negative.svg old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-grayscale.png b/themes/default/img/FreedomBox-logo-grayscale.png old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-grayscale.svg b/themes/default/img/FreedomBox-logo-grayscale.svg old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-lineart-negative.png b/themes/default/img/FreedomBox-logo-lineart-negative.png old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-lineart-negative.svg b/themes/default/img/FreedomBox-logo-lineart-negative.svg old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-lineart.png b/themes/default/img/FreedomBox-logo-lineart.png old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-lineart.svg b/themes/default/img/FreedomBox-logo-lineart.svg old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-standard.png b/themes/default/img/FreedomBox-logo-standard.png old mode 100755 new mode 100644 diff --git a/themes/default/img/FreedomBox-logo-standard.svg b/themes/default/img/FreedomBox-logo-standard.svg old mode 100755 new mode 100644 From 38bdff4d1d3bbf2416c6fe75036bf23d270f15a2 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 18:19:34 +0530 Subject: [PATCH 05/42] Make plinth directory a package, add version --- plinth/__init__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plinth/__init__.py b/plinth/__init__.py index e69de29bb..94f997920 100644 --- a/plinth/__init__.py +++ b/plinth/__init__.py @@ -0,0 +1,22 @@ +# +# This file is part of Plinth. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +""" +Plinth package init file +""" + +__version__ = '0.3.2' From bc21fe00c46e1006ab38e73f9dba1285ad0d91d0 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 18:25:21 +0530 Subject: [PATCH 06/42] Remove unmaintained, outdated fabfile --- fabfile.py | 235 ----------------------------------------------------- 1 file changed, 235 deletions(-) delete mode 100644 fabfile.py diff --git a/fabfile.py b/fabfile.py deleted file mode 100644 index c8bde9722..000000000 --- a/fabfile.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python - -# This is the fabric file I've been using to deploy things on my box -# and my freedombox. -# -# fab install should take you from base freedom-maker install to -# plinth box - -import os,sys, subprocess -import json -import fabric.api -from fabric.api import local, env, cd, put, get, task - -import cfg - -fb_ip = "10.5.53.155" - -BINDIR = "/usr/local/bin" - -# defaults -env.user = 'root' - -@task -def fb(): - "Use this to set host to our freedombox (e.g.: fab fb deploy)" - env.hosts = [fb_ip] - -@task -def all_hosts(): - "Use this to set host to both localhost and freedombox" - env.hosts = ["localhost", "192.168.2.115"] - -def remote_dir(): - if env.host == fb_ip: - return "/usr/local/share/plinth" - else: - return "/home/james/src/plinth" - -def run(*args, **kwargs): - if env.host == "localhost" or env.host=="127.0.0.1": - return local(*args, **kwargs) - else: - return fabric.api.run(*args, **kwargs) - -def sudo(*args, **kwargs): - if env.host == "localhost" or env.host=="127.0.0.1": - return run("sudo %s" % args[0], *args[1:], **kwargs) - elif env.user == "root": - return run(*args, **kwargs) - else: - return fabric.api.sudo(*args, **kwargs) - -@task -def get_remote_data_dir(): - with cd(remote_dir()): - data_dir = run('python -c "import cfg; print cfg.data_dir"') - env.remote_data_dir = os.path.join(remote_dir(), data_dir) - sudo('mkdir -p %s' % env.remote_data_dir) - return env.remote_data_dir - -@task -def move_data(): - "Move install's data dir to where cfg specifies it should be" - get_remote_data_dir() - with cd(remote_dir()): - sudo('mv data %s' % os.path.split(env.remote_data_dir)[0]) - -@task -def make(): - "Run the makefile, which generates docs and templates" - with cd(remote_dir()): - sudo('make') - -def make_link_unless_exists(src, dest): - sudo('test -f %s || ln -s %s %s' % (dest, src, dest)) - -def link(src, dest): - sudo('ln -fs %s %s' % (src, dest)) - -@task -def santiago(): - "Setup the Santiago port" - santiago_port = 52854 - sudo('ifconfig lo up') # or else tor start fails - sudo('apt-get install -y --no-install-recommends tor curl ntp') - - # tor needs accurate clock - sudo('date -s "%s"' % subprocess.check_output("date").rstrip()) - - # create tor hidden service dir - santiago_dir = os.path.join(get_remote_data_dir(), "santiago", "tor") - tor_dir = os.path.join(santiago_dir, "general") - sudo("mkdir -p " + tor_dir) - sudo("chown debian-tor:debian-tor " + tor_dir) - - # ensure hidden service config is in torrc - local("rm -rf __fab__torrc") - get("/etc/tor/torrc", "__fab__torrc") - with open ("__fab__torrc", 'r') as INF: - rc = INF.read() - local("rm -rf __fab__torrc") - hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (tor_dir, santiago_port) - if not hidden_service_config in rc: - sudo("echo '%s' >> /etc/tor/torrc" % hidden_service_config) - - sudo('service tor restart') - -def backslash_path(f): - if not f.startswith('/'): - f = os.path.abs(f) - if f == '/': - return '' - path, ret = os.path.split(f) - return backslash_path(path) + '\/' + ret - -@task -def apache(): - "configure apache to find reverse proxy for plinth" - sudo('apt-get install --no-install-recommends -y apache2 libapache2-mod-proxy-html apache2-utils openssl ssl-cert') - sudo('a2enmod proxy_http rewrite ssl') - sudo('touch /var/log/apache2/rewrite.log') - - ## ssl key and cert - ssl_target = "/etc/apache2/ssl/apache.pem" - sudo('mkdir -p %s' % os.path.split(ssl_target)[0]) - sudo('test -f %s || echo "US\nNY\nNYC\nFBox\n\n\n" | openssl req -new -x509 -days 999 -nodes -out %s -keyout %s' % (ssl_target, ssl_target, ssl_target)) - - conf_path = os.path.join(remote_dir(), "share/apache2/plinth.conf") - sudo("mkdir -p " + os.path.split(conf_path)[0]) - sudo("touch "+ conf_path) - sudo(r"sed -i 's/\(\s*\)DocumentRoot.*/\1DocumentRoot %s/g' %s" % ( - backslash_path(os.path.join(remote_dir(), "static")), - conf_path)) - link(conf_path, "/etc/apache2/sites-enabled/plinth.conf") - - sslconf_path = os.path.join(remote_dir(), "share/apache2/plinth-ssl.conf") - sudo("mkdir -p " + os.path.split(sslconf_path)[0]) - sudo("touch "+ sslconf_path) - sudo(r"sed -i 's/\(\s*\)DocumentRoot.*/\1DocumentRoot %s/g' %s" % ( - backslash_path(os.path.join(remote_dir(), "static")), - sslconf_path)) - link(sslconf_path, "/etc/apache2/sites-enabled/plinth-ssl.conf") - - sudo('rm -f /etc/apache2/sites-enabled/000-default') - sudo('service apache2 restart') - -@task -def deps(): - "Basic plinth dependencies" - sudo('apt-get install --no-install-recommends -y python make pandoc python-pyme python-django python-bootstrapform libjs-twitter-bootstrap') - -@task -def update(): - "Copy modified git-tracked files from this branch to remote" - - with cd(remote_dir()): - - ## Get .fab contents - sudo("touch .fab") - fab = run("cat .fab") - if not fab: - fab = {} - - ## Make list of files to put - try: - fab = json.loads(fab) - except: - fab={} - branch = [a[2:] for a in local("git branch", capture=True).split("\n") if a.startswith('*')][0] - files = local("git ls-tree -r --name-only %s" % branch, capture=True).split("\n") - else: - files = local("git diff --stat " + fab['last_update_from_commit'], capture=True).split("\n")[:-1] - files = [f.lstrip().split("|")[0].rstrip() for f in files] - - ## Put the files, one by one, respecting directories - dirs = {} - for pathspec in files: - d,fname = os.path.split(pathspec) - if not d in dirs.keys(): - dirs[d]=[] - dirs[d].append(pathspec) - if dirs: - sudo('mkdir -p %s' % ' '.join([os.path.join(remote_dir(), d) for d in dirs.keys()])) - for d in dirs: - for f in dirs[d]: - if os.path.islink(f): - linked = local("ls -l %s" % f, capture=True).split("-> ")[1] - #link(os.path.join(remote_dir(), linked), os.path.join(remote_dir(), d, os.path.basename(f))) - put(f, os.path.join(remote_dir(), d),mirror_local_mode=True) - if f.endswith(".py"): - run("rm -f " + os.path.join(remote_dir(), d, os.path.basename)+"c") - - ## restart - make() - sudo('/etc/init.d/plinth restart') - - ## Record activity so we only put changed files next time - commit = local("git log -n 1", capture=True).split("\n")[0].split(" ")[1] - fab['last_update_from_commit'] = commit - with open(".fab", 'w') as OUTF: - OUTF.write(json.dumps(fab)) - put(".fab", os.path.join(remote_dir(),".fab")) - local("rm -f .fab") - -@task -def link_bin(): - "Link executable and init.d script" - # todo: set daemon to point to currect binary - sudo('rm -rf ' + os.path.join(BINDIR, 'plinth.py')) - link(os.path.join(remote_dir(), "plinth.py"), os.path.join(BINDIR, 'plinth.py')) - sudo('rm -rf /etc/init.d/plinth') - link(os.path.join(remote_dir(), "share/init.d/plinth"), "/etc/init.d/plinth") - -@task -def restart(): - "Run plinth" - run('/etc/init.d/plinth restart') -@task -def stop(): - "Stop plinth" - run('/etc/init.d/plinth stop') - -@task -def proxy(): - put("proxy_up.py", remote_dir()) - -@task -def deploy(): - "Deploy plinth" - deps() - link_bin() - santiago() - update() - apache() - From 7798d924be15c67fd57ace20100660eccdaecffe Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 20:18:58 +0530 Subject: [PATCH 07/42] Create pythonic startup script --- bin/plinth | 23 ++++++++++++++++++++--- start.sh | 7 ------- 2 files changed, 20 insertions(+), 10 deletions(-) delete mode 100755 start.sh diff --git a/bin/plinth b/bin/plinth index dc862109d..03bbcbe9a 100644 --- a/bin/plinth +++ b/bin/plinth @@ -1,4 +1,21 @@ -#!/bin/sh +#!/usr/bin/python +# +# This file is part of Plinth. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# -export PYTHONPATH=/usr/share/plinth/python -exec python /usr/share/plinth/python/plinth/plinth.py "$@" +import plinth.__main__ + +plinth.__main__.main() diff --git a/start.sh b/start.sh deleted file mode 100755 index 0ee1c534d..000000000 --- a/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/sh - -#PYTHONPATH=$PYTHONPATH - -export PYTHONPATH - -python plinth.py From d3b9c0d6ec51ff30d5ff464def953fb49e5d0854 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 20:19:32 +0530 Subject: [PATCH 08/42] Remove recursive link to static director --- static/static | 1 - 1 file changed, 1 deletion(-) delete mode 120000 static/static diff --git a/static/static b/static/static deleted file mode 120000 index 945c9b46d..000000000 --- a/static/static +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file From cee3c3a4167d0facfea28d42c9923d3aabd22044 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 20:21:20 +0530 Subject: [PATCH 09/42] Ignore python dist and egg-info directories --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3b9739d04..2f2795c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ predepend build/ *.pid .emacs.desktop* +*.egg-info/ +dist/ From ff288cf2cfff9aef6995b8e53e1c1011e7eafee6 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 29 Aug 2014 23:38:06 +0530 Subject: [PATCH 10/42] Convert module/enabled files to regular files --- plinth/modules/enabled/apps | 1 - plinth/modules/enabled/config | 1 - plinth/modules/enabled/diagnostics | 1 - plinth/modules/enabled/expert_mode | 1 - plinth/modules/enabled/firewall | 1 - plinth/modules/enabled/first_boot | 1 - plinth/modules/enabled/help | 1 - plinth/modules/enabled/lib | 1 - plinth/modules/enabled/owncloud | 1 - plinth/modules/enabled/packages | 1 - plinth/modules/enabled/pagekite | 1 - plinth/modules/enabled/system | 1 - plinth/modules/enabled/tor | 1 - plinth/modules/enabled/users | 1 - plinth/modules/enabled/xmpp | 1 - 15 files changed, 15 deletions(-) mode change 120000 => 100644 plinth/modules/enabled/apps mode change 120000 => 100644 plinth/modules/enabled/config mode change 120000 => 100644 plinth/modules/enabled/diagnostics mode change 120000 => 100644 plinth/modules/enabled/expert_mode mode change 120000 => 100644 plinth/modules/enabled/firewall mode change 120000 => 100644 plinth/modules/enabled/first_boot mode change 120000 => 100644 plinth/modules/enabled/help mode change 120000 => 100644 plinth/modules/enabled/lib mode change 120000 => 100644 plinth/modules/enabled/owncloud mode change 120000 => 100644 plinth/modules/enabled/packages mode change 120000 => 100644 plinth/modules/enabled/pagekite mode change 120000 => 100644 plinth/modules/enabled/system mode change 120000 => 100644 plinth/modules/enabled/tor mode change 120000 => 100644 plinth/modules/enabled/users mode change 120000 => 100644 plinth/modules/enabled/xmpp diff --git a/plinth/modules/enabled/apps b/plinth/modules/enabled/apps deleted file mode 120000 index ee655a64d..000000000 --- a/plinth/modules/enabled/apps +++ /dev/null @@ -1 +0,0 @@ -../apps/ \ No newline at end of file diff --git a/plinth/modules/enabled/apps b/plinth/modules/enabled/apps new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/config b/plinth/modules/enabled/config deleted file mode 120000 index 408852685..000000000 --- a/plinth/modules/enabled/config +++ /dev/null @@ -1 +0,0 @@ -../config/ \ No newline at end of file diff --git a/plinth/modules/enabled/config b/plinth/modules/enabled/config new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/diagnostics b/plinth/modules/enabled/diagnostics deleted file mode 120000 index 44f76bee7..000000000 --- a/plinth/modules/enabled/diagnostics +++ /dev/null @@ -1 +0,0 @@ -../diagnostics/ \ No newline at end of file diff --git a/plinth/modules/enabled/diagnostics b/plinth/modules/enabled/diagnostics new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/expert_mode b/plinth/modules/enabled/expert_mode deleted file mode 120000 index 0006eedc0..000000000 --- a/plinth/modules/enabled/expert_mode +++ /dev/null @@ -1 +0,0 @@ -../expert_mode/ \ No newline at end of file diff --git a/plinth/modules/enabled/expert_mode b/plinth/modules/enabled/expert_mode new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/firewall b/plinth/modules/enabled/firewall deleted file mode 120000 index ecb364d05..000000000 --- a/plinth/modules/enabled/firewall +++ /dev/null @@ -1 +0,0 @@ -../firewall/ \ No newline at end of file diff --git a/plinth/modules/enabled/firewall b/plinth/modules/enabled/firewall new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/first_boot b/plinth/modules/enabled/first_boot deleted file mode 120000 index b977d6c94..000000000 --- a/plinth/modules/enabled/first_boot +++ /dev/null @@ -1 +0,0 @@ -../first_boot/ \ No newline at end of file diff --git a/plinth/modules/enabled/first_boot b/plinth/modules/enabled/first_boot new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/help b/plinth/modules/enabled/help deleted file mode 120000 index 76c213eda..000000000 --- a/plinth/modules/enabled/help +++ /dev/null @@ -1 +0,0 @@ -../help/ \ No newline at end of file diff --git a/plinth/modules/enabled/help b/plinth/modules/enabled/help new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/lib b/plinth/modules/enabled/lib deleted file mode 120000 index 5bf80bf13..000000000 --- a/plinth/modules/enabled/lib +++ /dev/null @@ -1 +0,0 @@ -../lib/ \ No newline at end of file diff --git a/plinth/modules/enabled/lib b/plinth/modules/enabled/lib new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/owncloud b/plinth/modules/enabled/owncloud deleted file mode 120000 index b9d942937..000000000 --- a/plinth/modules/enabled/owncloud +++ /dev/null @@ -1 +0,0 @@ -../owncloud/ \ No newline at end of file diff --git a/plinth/modules/enabled/owncloud b/plinth/modules/enabled/owncloud new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/packages b/plinth/modules/enabled/packages deleted file mode 120000 index f314f73fa..000000000 --- a/plinth/modules/enabled/packages +++ /dev/null @@ -1 +0,0 @@ -../packages/ \ No newline at end of file diff --git a/plinth/modules/enabled/packages b/plinth/modules/enabled/packages new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/pagekite b/plinth/modules/enabled/pagekite deleted file mode 120000 index 1c4c9c144..000000000 --- a/plinth/modules/enabled/pagekite +++ /dev/null @@ -1 +0,0 @@ -../pagekite/ \ No newline at end of file diff --git a/plinth/modules/enabled/pagekite b/plinth/modules/enabled/pagekite new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/system b/plinth/modules/enabled/system deleted file mode 120000 index 16f8cc2b2..000000000 --- a/plinth/modules/enabled/system +++ /dev/null @@ -1 +0,0 @@ -../system/ \ No newline at end of file diff --git a/plinth/modules/enabled/system b/plinth/modules/enabled/system new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/tor b/plinth/modules/enabled/tor deleted file mode 120000 index f7495e4ab..000000000 --- a/plinth/modules/enabled/tor +++ /dev/null @@ -1 +0,0 @@ -../tor/ \ No newline at end of file diff --git a/plinth/modules/enabled/tor b/plinth/modules/enabled/tor new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/users b/plinth/modules/enabled/users deleted file mode 120000 index db9284fbb..000000000 --- a/plinth/modules/enabled/users +++ /dev/null @@ -1 +0,0 @@ -../users/ \ No newline at end of file diff --git a/plinth/modules/enabled/users b/plinth/modules/enabled/users new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/enabled/xmpp b/plinth/modules/enabled/xmpp deleted file mode 120000 index 686474fe7..000000000 --- a/plinth/modules/enabled/xmpp +++ /dev/null @@ -1 +0,0 @@ -../xmpp/ \ No newline at end of file diff --git a/plinth/modules/enabled/xmpp b/plinth/modules/enabled/xmpp new file mode 100644 index 000000000..e69de29bb From 64b6a1294e99bdcf25dd3ea86e898f2115abe763 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:17:21 +0530 Subject: [PATCH 11/42] Remove unused testdata directory --- plinth/tests/testdata/users.sqlite3 | Bin 3072 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 plinth/tests/testdata/users.sqlite3 diff --git a/plinth/tests/testdata/users.sqlite3 b/plinth/tests/testdata/users.sqlite3 deleted file mode 100644 index 03782a7d7f4282049ab931c01f0df26b5534545f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3072 zcmWFz^vNtqRY=P(%1ta$FlJz3U}R))P*7lCU`%FUU|@ zBSl{3KMYLF-3-j#%oouVjB-aqU^E0EA>hKuCN3_{m|2pTl#^Oql3xTNn4E)L9Yb6d zLL8lZTou6L3L4p|l?o-P6(tI#d6|W!sX7W}i8){aO-&{?aa(alhRnQ_)QaN59ANH_ zPb@9T2lL~>+T#tu6ew@A@Ph1S0cP|*W(kNhM#<3-7!3hn2)v+qD70a*p$Ll@4TZQs eW`pwoC+0^qv}V-k(GVC7fq@DEIW&v;5PSg0W;EIW From 709a540381569fc7c1225ad8bf016051b96ea92a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:18:36 +0530 Subject: [PATCH 12/42] Rename test cases to have python standard name --- plinth/tests/{actions_test.py => test_actions.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plinth/tests/{actions_test.py => test_actions.py} (100%) diff --git a/plinth/tests/actions_test.py b/plinth/tests/test_actions.py similarity index 100% rename from plinth/tests/actions_test.py rename to plinth/tests/test_actions.py From 0af0a593b7750b1ec3b352159a2e0212ae7f1b78 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:30:33 +0530 Subject: [PATCH 13/42] Replace test case runner with a pythonic version --- test | 28 ++++++++++++++++++++++++++++ test.sh | 30 ------------------------------ 2 files changed, 28 insertions(+), 30 deletions(-) create mode 100755 test delete mode 100755 test.sh diff --git a/test b/test new file mode 100755 index 000000000..47a9728fd --- /dev/null +++ b/test @@ -0,0 +1,28 @@ +#!/usr/bin/python +# +# This file is part of Plinth. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +""" +Script to run Plinth test cases +""" + +import unittest + + +if __name__ == '__main__': + test_suite = unittest.defaultTestLoader.discover('plinth.tests') + unittest.TextTestRunner().run(test_suite) diff --git a/test.sh b/test.sh deleted file mode 100755 index d1526c4c3..000000000 --- a/test.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh - -# This file is meant to be run from the Plinth root directory: -# -# $ cd plinth/ -# $ ./test.sh - -PYTHONPATH=modules/installed/lib:$PYTHONPATH -PYTHONPATH=vendor:$PYTHONPATH -PYTHONPATH=.:$PYTHONPATH -export PYTHONPATH - -for arg in "$@" -do - if [ "$arg" = "--pause" ] - then - pause=1 - fi -done - -for file in tests/*.py -do - echo "Testing ${file}:" - python $file - - if [ "$pause" = 1 ] - then - read X - fi -done From c95db2fe7e60b6ab72bef66524bd309ac7e3b314 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:31:16 +0530 Subject: [PATCH 14/42] Move themes directory into static directory --- .../themes}/default/FreedomBox-Identity-Manual.pdf | Bin .../themes}/default/FreedomBox-Logo.7z | Bin .../default/css/bootstrap-responsive.min.css | 0 .../themes}/default/css/bootstrap.min.css | 0 {themes => static/themes}/default/css/plinth.css | 0 .../img/FreedomBox-logo-grayscale-negative.png | Bin .../img/FreedomBox-logo-grayscale-negative.svg | 0 .../default/img/FreedomBox-logo-grayscale.png | Bin .../default/img/FreedomBox-logo-grayscale.svg | 0 .../img/FreedomBox-logo-lineart-negative.png | Bin .../img/FreedomBox-logo-lineart-negative.svg | 0 .../themes}/default/img/FreedomBox-logo-lineart.png | Bin .../themes}/default/img/FreedomBox-logo-lineart.svg | 0 .../default/img/FreedomBox-logo-standard.png | Bin .../default/img/FreedomBox-logo-standard.svg | 0 .../img/apple-touch-icon-114px-precomposed.png | Bin .../img/apple-touch-icon-57px-precomposed.png | Bin .../img/apple-touch-icon-72px-precomposed.png | Bin .../themes}/default/img/apple-touch-icon.xcf | Bin .../themes}/default/img/favicon-32px.ico | Bin {themes => static/themes}/default/img/favicon.ico | Bin .../themes}/default/img/freedombox-logo-200px.png | Bin .../themes}/default/img/freedombox-logo-250px.png | Bin .../themes}/default/img/freedombox-logo-32px.png | Bin .../themes}/default/img/freedombox-logotype.png | Bin .../default/img/glyphicons-halflings-white.png | Bin .../themes}/default/img/glyphicons-halflings.png | Bin .../themes}/default/js/libs/bootstrap.min.js | 0 .../themes}/default/js/libs/jquery.min.js | 0 .../themes}/default/js/libs/modernizr.min.js | 0 {themes => static/themes}/default/readme.md | 0 {themes => static/themes}/default/screenshot.png | Bin 32 files changed, 0 insertions(+), 0 deletions(-) rename {themes => static/themes}/default/FreedomBox-Identity-Manual.pdf (100%) rename {themes => static/themes}/default/FreedomBox-Logo.7z (100%) rename {themes => static/themes}/default/css/bootstrap-responsive.min.css (100%) rename {themes => static/themes}/default/css/bootstrap.min.css (100%) rename {themes => static/themes}/default/css/plinth.css (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-grayscale-negative.png (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-grayscale-negative.svg (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-grayscale.png (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-grayscale.svg (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-lineart-negative.png (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-lineart-negative.svg (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-lineart.png (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-lineart.svg (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-standard.png (100%) rename {themes => static/themes}/default/img/FreedomBox-logo-standard.svg (100%) rename {themes => static/themes}/default/img/apple-touch-icon-114px-precomposed.png (100%) rename {themes => static/themes}/default/img/apple-touch-icon-57px-precomposed.png (100%) rename {themes => static/themes}/default/img/apple-touch-icon-72px-precomposed.png (100%) rename {themes => static/themes}/default/img/apple-touch-icon.xcf (100%) rename {themes => static/themes}/default/img/favicon-32px.ico (100%) rename {themes => static/themes}/default/img/favicon.ico (100%) rename {themes => static/themes}/default/img/freedombox-logo-200px.png (100%) rename {themes => static/themes}/default/img/freedombox-logo-250px.png (100%) rename {themes => static/themes}/default/img/freedombox-logo-32px.png (100%) rename {themes => static/themes}/default/img/freedombox-logotype.png (100%) rename {themes => static/themes}/default/img/glyphicons-halflings-white.png (100%) rename {themes => static/themes}/default/img/glyphicons-halflings.png (100%) rename {themes => static/themes}/default/js/libs/bootstrap.min.js (100%) rename {themes => static/themes}/default/js/libs/jquery.min.js (100%) rename {themes => static/themes}/default/js/libs/modernizr.min.js (100%) rename {themes => static/themes}/default/readme.md (100%) rename {themes => static/themes}/default/screenshot.png (100%) diff --git a/themes/default/FreedomBox-Identity-Manual.pdf b/static/themes/default/FreedomBox-Identity-Manual.pdf similarity index 100% rename from themes/default/FreedomBox-Identity-Manual.pdf rename to static/themes/default/FreedomBox-Identity-Manual.pdf diff --git a/themes/default/FreedomBox-Logo.7z b/static/themes/default/FreedomBox-Logo.7z similarity index 100% rename from themes/default/FreedomBox-Logo.7z rename to static/themes/default/FreedomBox-Logo.7z diff --git a/themes/default/css/bootstrap-responsive.min.css b/static/themes/default/css/bootstrap-responsive.min.css similarity index 100% rename from themes/default/css/bootstrap-responsive.min.css rename to static/themes/default/css/bootstrap-responsive.min.css diff --git a/themes/default/css/bootstrap.min.css b/static/themes/default/css/bootstrap.min.css similarity index 100% rename from themes/default/css/bootstrap.min.css rename to static/themes/default/css/bootstrap.min.css diff --git a/themes/default/css/plinth.css b/static/themes/default/css/plinth.css similarity index 100% rename from themes/default/css/plinth.css rename to static/themes/default/css/plinth.css diff --git a/themes/default/img/FreedomBox-logo-grayscale-negative.png b/static/themes/default/img/FreedomBox-logo-grayscale-negative.png similarity index 100% rename from themes/default/img/FreedomBox-logo-grayscale-negative.png rename to static/themes/default/img/FreedomBox-logo-grayscale-negative.png diff --git a/themes/default/img/FreedomBox-logo-grayscale-negative.svg b/static/themes/default/img/FreedomBox-logo-grayscale-negative.svg similarity index 100% rename from themes/default/img/FreedomBox-logo-grayscale-negative.svg rename to static/themes/default/img/FreedomBox-logo-grayscale-negative.svg diff --git a/themes/default/img/FreedomBox-logo-grayscale.png b/static/themes/default/img/FreedomBox-logo-grayscale.png similarity index 100% rename from themes/default/img/FreedomBox-logo-grayscale.png rename to static/themes/default/img/FreedomBox-logo-grayscale.png diff --git a/themes/default/img/FreedomBox-logo-grayscale.svg b/static/themes/default/img/FreedomBox-logo-grayscale.svg similarity index 100% rename from themes/default/img/FreedomBox-logo-grayscale.svg rename to static/themes/default/img/FreedomBox-logo-grayscale.svg diff --git a/themes/default/img/FreedomBox-logo-lineart-negative.png b/static/themes/default/img/FreedomBox-logo-lineart-negative.png similarity index 100% rename from themes/default/img/FreedomBox-logo-lineart-negative.png rename to static/themes/default/img/FreedomBox-logo-lineart-negative.png diff --git a/themes/default/img/FreedomBox-logo-lineart-negative.svg b/static/themes/default/img/FreedomBox-logo-lineart-negative.svg similarity index 100% rename from themes/default/img/FreedomBox-logo-lineart-negative.svg rename to static/themes/default/img/FreedomBox-logo-lineart-negative.svg diff --git a/themes/default/img/FreedomBox-logo-lineart.png b/static/themes/default/img/FreedomBox-logo-lineart.png similarity index 100% rename from themes/default/img/FreedomBox-logo-lineart.png rename to static/themes/default/img/FreedomBox-logo-lineart.png diff --git a/themes/default/img/FreedomBox-logo-lineart.svg b/static/themes/default/img/FreedomBox-logo-lineart.svg similarity index 100% rename from themes/default/img/FreedomBox-logo-lineart.svg rename to static/themes/default/img/FreedomBox-logo-lineart.svg diff --git a/themes/default/img/FreedomBox-logo-standard.png b/static/themes/default/img/FreedomBox-logo-standard.png similarity index 100% rename from themes/default/img/FreedomBox-logo-standard.png rename to static/themes/default/img/FreedomBox-logo-standard.png diff --git a/themes/default/img/FreedomBox-logo-standard.svg b/static/themes/default/img/FreedomBox-logo-standard.svg similarity index 100% rename from themes/default/img/FreedomBox-logo-standard.svg rename to static/themes/default/img/FreedomBox-logo-standard.svg diff --git a/themes/default/img/apple-touch-icon-114px-precomposed.png b/static/themes/default/img/apple-touch-icon-114px-precomposed.png similarity index 100% rename from themes/default/img/apple-touch-icon-114px-precomposed.png rename to static/themes/default/img/apple-touch-icon-114px-precomposed.png diff --git a/themes/default/img/apple-touch-icon-57px-precomposed.png b/static/themes/default/img/apple-touch-icon-57px-precomposed.png similarity index 100% rename from themes/default/img/apple-touch-icon-57px-precomposed.png rename to static/themes/default/img/apple-touch-icon-57px-precomposed.png diff --git a/themes/default/img/apple-touch-icon-72px-precomposed.png b/static/themes/default/img/apple-touch-icon-72px-precomposed.png similarity index 100% rename from themes/default/img/apple-touch-icon-72px-precomposed.png rename to static/themes/default/img/apple-touch-icon-72px-precomposed.png diff --git a/themes/default/img/apple-touch-icon.xcf b/static/themes/default/img/apple-touch-icon.xcf similarity index 100% rename from themes/default/img/apple-touch-icon.xcf rename to static/themes/default/img/apple-touch-icon.xcf diff --git a/themes/default/img/favicon-32px.ico b/static/themes/default/img/favicon-32px.ico similarity index 100% rename from themes/default/img/favicon-32px.ico rename to static/themes/default/img/favicon-32px.ico diff --git a/themes/default/img/favicon.ico b/static/themes/default/img/favicon.ico similarity index 100% rename from themes/default/img/favicon.ico rename to static/themes/default/img/favicon.ico diff --git a/themes/default/img/freedombox-logo-200px.png b/static/themes/default/img/freedombox-logo-200px.png similarity index 100% rename from themes/default/img/freedombox-logo-200px.png rename to static/themes/default/img/freedombox-logo-200px.png diff --git a/themes/default/img/freedombox-logo-250px.png b/static/themes/default/img/freedombox-logo-250px.png similarity index 100% rename from themes/default/img/freedombox-logo-250px.png rename to static/themes/default/img/freedombox-logo-250px.png diff --git a/themes/default/img/freedombox-logo-32px.png b/static/themes/default/img/freedombox-logo-32px.png similarity index 100% rename from themes/default/img/freedombox-logo-32px.png rename to static/themes/default/img/freedombox-logo-32px.png diff --git a/themes/default/img/freedombox-logotype.png b/static/themes/default/img/freedombox-logotype.png similarity index 100% rename from themes/default/img/freedombox-logotype.png rename to static/themes/default/img/freedombox-logotype.png diff --git a/themes/default/img/glyphicons-halflings-white.png b/static/themes/default/img/glyphicons-halflings-white.png similarity index 100% rename from themes/default/img/glyphicons-halflings-white.png rename to static/themes/default/img/glyphicons-halflings-white.png diff --git a/themes/default/img/glyphicons-halflings.png b/static/themes/default/img/glyphicons-halflings.png similarity index 100% rename from themes/default/img/glyphicons-halflings.png rename to static/themes/default/img/glyphicons-halflings.png diff --git a/themes/default/js/libs/bootstrap.min.js b/static/themes/default/js/libs/bootstrap.min.js similarity index 100% rename from themes/default/js/libs/bootstrap.min.js rename to static/themes/default/js/libs/bootstrap.min.js diff --git a/themes/default/js/libs/jquery.min.js b/static/themes/default/js/libs/jquery.min.js similarity index 100% rename from themes/default/js/libs/jquery.min.js rename to static/themes/default/js/libs/jquery.min.js diff --git a/themes/default/js/libs/modernizr.min.js b/static/themes/default/js/libs/modernizr.min.js similarity index 100% rename from themes/default/js/libs/modernizr.min.js rename to static/themes/default/js/libs/modernizr.min.js diff --git a/themes/default/readme.md b/static/themes/default/readme.md similarity index 100% rename from themes/default/readme.md rename to static/themes/default/readme.md diff --git a/themes/default/screenshot.png b/static/themes/default/screenshot.png similarity index 100% rename from themes/default/screenshot.png rename to static/themes/default/screenshot.png From e0816cd4325cfd9914198ebe836d2c25a0e8c8f8 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:33:53 +0530 Subject: [PATCH 15/42] Update test cases for new directory structure --- plinth/tests/test_actions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plinth/tests/test_actions.py b/plinth/tests/test_actions.py index 0107eb58a..613afa8c4 100644 --- a/plinth/tests/test_actions.py +++ b/plinth/tests/test_actions.py @@ -1,17 +1,19 @@ -#! /usr/bin/env python +#!/usr/bin/python # -*- mode: python; mode: auto-fill; fill-column: 80 -*- -from actions import superuser_run, run import os import shlex import subprocess import unittest -import cfg +from plinth.actions import superuser_run, run +from plinth import cfg + ROOT_DIR = os.path.split(os.path.abspath(os.path.split(__file__)[0]))[0] cfg.actions_dir = os.path.join(ROOT_DIR, 'actions') + class TestPrivileged(unittest.TestCase): """Verify that privileged actions perform as expected. @@ -110,5 +112,6 @@ class TestPrivileged(unittest.TestCase): subprocess.check_output(shlex.split("id -ur")).strip(), run("id", ["-u" ,"-r"])[0].strip()) + if __name__ == "__main__": unittest.main() From 091faf4eaa651cea0685cdf8601af7540d27a481 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:35:26 +0530 Subject: [PATCH 16/42] Update default theme link --- static/theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/theme b/static/theme index 22c03a13e..932f05ef2 120000 --- a/static/theme +++ b/static/theme @@ -1 +1 @@ -../themes/default \ No newline at end of file +themes/default/ \ No newline at end of file From e6dbcdccaa004f931e9366c846fda401c4d2d74c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:37:45 +0530 Subject: [PATCH 17/42] Move all misc files under misc directory --- .../apache2/sites-available}/plinth-ssl.conf | 0 .../etc/apache2/sites-available}/plinth.conf | 0 {share => data/etc}/init.d/plinth | 0 data/etc/plinth/plinth.config | 23 +++++++++++++++++++ {sudoers.d => data/etc/sudoers.d}/plinth | 0 .../lib}/freedombox/first-run.d/90_firewall | 0 .../usr/lib/freedombox/setup.d}/86_plinth | 0 7 files changed, 23 insertions(+) rename {share/apache2 => data/etc/apache2/sites-available}/plinth-ssl.conf (100%) rename {share/apache2 => data/etc/apache2/sites-available}/plinth.conf (100%) rename {share => data/etc}/init.d/plinth (100%) create mode 100644 data/etc/plinth/plinth.config rename {sudoers.d => data/etc/sudoers.d}/plinth (100%) rename {lib => data/usr/lib}/freedombox/first-run.d/90_firewall (100%) rename {setup.d => data/usr/lib/freedombox/setup.d}/86_plinth (100%) diff --git a/share/apache2/plinth-ssl.conf b/data/etc/apache2/sites-available/plinth-ssl.conf similarity index 100% rename from share/apache2/plinth-ssl.conf rename to data/etc/apache2/sites-available/plinth-ssl.conf diff --git a/share/apache2/plinth.conf b/data/etc/apache2/sites-available/plinth.conf similarity index 100% rename from share/apache2/plinth.conf rename to data/etc/apache2/sites-available/plinth.conf diff --git a/share/init.d/plinth b/data/etc/init.d/plinth similarity index 100% rename from share/init.d/plinth rename to data/etc/init.d/plinth diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config new file mode 100644 index 000000000..4cf364501 --- /dev/null +++ b/data/etc/plinth/plinth.config @@ -0,0 +1,23 @@ +[Name] +product_name = Plinth +box_name = FreedomBox + +[Path] +# directory locations +file_root = /usr/share/plinth/static +data_dir = /var/lib/plinth +log_dir = /var/log/plinth +pid_dir = /var/run +actions_dir = /usr/share/plinth/actions +server_dir = plinth/ + +# file locations +store_file = %(data_dir)s/store.sqlite3 +user_db = %(data_dir)s/users.sqlite3 +status_log_file = %(log_dir)s/status.log +access_log_file = %(log_dir)s/access.log +pidfile = %(pid_dir)s/pidfile.pid + +[Network] +host = 127.0.0.1 +port = 8000 diff --git a/sudoers.d/plinth b/data/etc/sudoers.d/plinth similarity index 100% rename from sudoers.d/plinth rename to data/etc/sudoers.d/plinth diff --git a/lib/freedombox/first-run.d/90_firewall b/data/usr/lib/freedombox/first-run.d/90_firewall similarity index 100% rename from lib/freedombox/first-run.d/90_firewall rename to data/usr/lib/freedombox/first-run.d/90_firewall diff --git a/setup.d/86_plinth b/data/usr/lib/freedombox/setup.d/86_plinth similarity index 100% rename from setup.d/86_plinth rename to data/usr/lib/freedombox/setup.d/86_plinth From 85f02c744edd68e6c42a99545287f3b4eedce4bd Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 09:41:47 +0530 Subject: [PATCH 18/42] Remove vendor directory infavor of python module dependencies --- .gitmodules | 6 ------ plinth/__main__.py | 9 --------- vendor/__init__.py | 0 vendor/withsqlite | 1 - 4 files changed, 16 deletions(-) delete mode 100644 .gitmodules delete mode 100644 vendor/__init__.py delete mode 160000 vendor/withsqlite diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9622603f6..000000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "vendor/withsqlite"] - path = vendor/withsqlite - url = git://github.com/jvasile/withsqlite.git -[submodule "vendor/exmachina"] - path = vendor/exmachina - url = git://github.com/jvasile/exmachina.git diff --git a/plinth/__main__.py b/plinth/__main__.py index 25a67d652..b418b2b26 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -64,13 +64,6 @@ def setup_logging(): cherrypy.log.screen = False -def setup_paths(): - """Setup current directory and python import paths""" - os.chdir(cfg.python_root) - if not os.path.join(cfg.file_root, 'vendor') in sys.path: - sys.path.append(os.path.join(cfg.file_root, 'vendor')) - - def setup_server(): """Setup CherryPy server""" LOGGER.info('Setting up CherryPy server') @@ -224,8 +217,6 @@ def main(): service.init() - setup_paths() - configure_django() module_loader.load_modules() diff --git a/vendor/__init__.py b/vendor/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/withsqlite b/vendor/withsqlite deleted file mode 160000 index 3558eaf5e..000000000 --- a/vendor/withsqlite +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3558eaf5e997920da1994aa8f2b52086c0bfbfb4 From 7e3d8ce54bd9bca910be3ee98949c050cb048784 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 20:50:55 +0530 Subject: [PATCH 19/42] Use os.mkdirs instead of custom method --- plinth/modules/santiago/santiago.py | 2 +- plinth/util.py | 23 ----------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/plinth/modules/santiago/santiago.py b/plinth/modules/santiago/santiago.py index e9339fe55..d07b713a2 100644 --- a/plinth/modules/santiago/santiago.py +++ b/plinth/modules/santiago/santiago.py @@ -43,7 +43,7 @@ class Santiago(PagePlugin): self.santiago_dir = os.path.join(cfg.file_root, "data", "santiago", "tor") self.tor_dir = os.path.join(self.santiago_dir, "general") - u.mkdir(self.santiago_dir) + os.mkdirs(self.santiago_dir) os.system( 'chmod a+w %s' % self.santiago_dir) hidden_service_config = "HiddenServiceDir %s\nHiddenServicePort 80 127.0.0.1:%d" % (self.tor_dir, santiago_port) if hidden_service_config in rc: diff --git a/plinth/util.py b/plinth/util.py index b593fb8d8..592725f03 100644 --- a/plinth/util.py +++ b/plinth/util.py @@ -1,26 +1,3 @@ -import os - - -def mkdir(newdir): - """works the way a good mkdir should :) - - already exists, silently complete - - regular file in the way, raise an exception - - parent directory(ies) does not exist, make them as well - """ - if os.path.isdir(newdir): - pass - elif os.path.isfile(newdir): - raise OSError("a file with the same name as the desired " \ - "dir, '%s', already exists." % newdir) - else: - head, tail = os.path.split(newdir) - if head and not os.path.isdir(head): - mkdir(head) - #print "mkdir %s" % repr(newdir) - if tail: - os.mkdir(newdir) - - def slurp(filespec): with open(filespec) as x: f = x.read() return f From 06a50c6985e80f6f930219e0519946158a4ab5bf Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 20:56:11 +0530 Subject: [PATCH 20/42] Use open().read() instead of slurp() --- plinth/modules/config/config.py | 3 +-- plinth/util.py | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 plinth/util.py diff --git a/plinth/modules/config/config.py b/plinth/modules/config/config.py index 5c88424cd..602a977c9 100644 --- a/plinth/modules/config/config.py +++ b/plinth/modules/config/config.py @@ -31,7 +31,6 @@ import socket from plinth import actions from plinth import cfg -from plinth import util LOGGER = logging.getLogger(__name__) @@ -127,7 +126,7 @@ def index(request): def get_status(): """Return the current status""" return {'hostname': get_hostname(), - 'time_zone': util.slurp('/etc/timezone').rstrip()} + 'time_zone': open('/etc/timezone').read().rstrip()} def _apply_changes(request, old_status, new_status): diff --git a/plinth/util.py b/plinth/util.py deleted file mode 100644 index 592725f03..000000000 --- a/plinth/util.py +++ /dev/null @@ -1,8 +0,0 @@ -def slurp(filespec): - with open(filespec) as x: f = x.read() - return f - - -def unslurp(filespec, msg): - with open(filespec, 'w') as x: - x.write(msg) From dc97af245e3bde16ffd98b8ad6729387798a0c1f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 30 Aug 2014 22:17:47 +0530 Subject: [PATCH 21/42] Remove outdated NOTES file - Contains changelog like items that should be availble throught git. --- NOTES | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 NOTES diff --git a/NOTES b/NOTES deleted file mode 100644 index dbdebd53c..000000000 --- a/NOTES +++ /dev/null @@ -1,36 +0,0 @@ -% PLINTH -% -% February 2012 - -# Edits by bnewbold - -## 2012-07-12 "exmachina" configuration management layer - -- this new code is very ugly and in the "just make it work" style -- add exmachina code and test code -- modify plinth.py to listen for shared secret on stdin at start - (if appropriate flag is set) and try to connect to exmachina daemon -- use exmachina to read and set /etc/hostname as a demo -- update plinth init.d script to start exmachina and share keys -- update docs with new deps and run instructions - -# Edits by seandiggity - -## 2012-02-27 new theme based upon bootstrap - -Added Bootstrap code from Twitter's Bootstrap http://twitter.github.com/bootstrap -Additional images, css changes -Consolidated Bootstrap, Boilerplate, HTML5-Reset code -Edited text and forms for some modules (as a CMS, Plinth's fetching of text and forms from static files needs rethinking) -Changed menu javascript to work with Bootstrap styles - -## 2012-02-24 template and theme changes - -Added HTML5-Reset code http://html5reset.org -Removed robots.txt (we have "noindex,nofollow" in the template meta tags, do we need this?) -Added meta noindex,nofollow,noarchive tags for specific robots (googlebot etc.) -Removed extraneous meta tags useful only for indexing -Removed HTML5-Reset "_" directory. Not sure why it's useful to add an ambiguous folder to the directory tree. -Made sure no Google-y code wasn't included (analytics, remote copy of JQuery, etc.) -Fixed symbolic link docs/style.css -New favicon and iOS "web clip" button From b9e668541b690d007662ec4bbf5c934b735f563e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 12:59:35 +0530 Subject: [PATCH 22/42] Remove outdated dependencies on python-bcrypt and python-passlib --- INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index a32ae8fb8..d9c8bd94b 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Install the dependencies: -apt-get install pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-bootstrapform libjs-twitter-bootstrap sudo +apt-get install pandoc psmisc python2.7 python-cherrypy3 python-django python-bootstrapform libjs-twitter-bootstrap sudo Unzip and untar the source into a directory. Change to the directory containing the program. Run: From 5ed58d66324681636f50e46c649ab39093f5a8ad Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:05:21 +0530 Subject: [PATCH 23/42] Rename plinth.sample.config to plinth.config --- .gitignore | 1 - plinth.sample.config => plinth.config | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) rename plinth.sample.config => plinth.config (87%) diff --git a/.gitignore b/.gitignore index 2f2795c8f..6c43468cd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ doc/README.mdwn doc/TODO.mdwn doc/oneline.txt doc/plinth.1 -plinth.config TODO \#* .#* diff --git a/plinth.sample.config b/plinth.config similarity index 87% rename from plinth.sample.config rename to plinth.config index 4a900b7c9..e13312dad 100644 --- a/plinth.sample.config +++ b/plinth.config @@ -8,16 +8,16 @@ file_root = %(root)s data_dir = %(file_root)s/data log_dir = %(data_dir)s pid_dir = %(data_dir)s -python_root = %(file_root)s server_dir = plinth/ actions_dir = %(file_root)s/actions +doc_dir = %(file_root)s/doc # file locations store_file = %(data_dir)s/store.sqlite3 user_db = %(data_dir)s/users.sqlite3 status_log_file = %(log_dir)s/status.log access_log_file = %(log_dir)s/access.log -pidfile = %(pid_dir)s/pidfile.pid +pidfile = %(pid_dir)s/plinth.pid [Network] host = 127.0.0.1 From 33f8015835edca9e44a5a38b98e69600d6c5559b Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:07:00 +0530 Subject: [PATCH 24/42] Make the help module read documentation directory from config --- data/etc/plinth/plinth.config | 3 ++- plinth/cfg.py | 2 ++ plinth/modules/help/help.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config index 4cf364501..95d443267 100644 --- a/data/etc/plinth/plinth.config +++ b/data/etc/plinth/plinth.config @@ -8,8 +8,9 @@ file_root = /usr/share/plinth/static data_dir = /var/lib/plinth log_dir = /var/log/plinth pid_dir = /var/run -actions_dir = /usr/share/plinth/actions server_dir = plinth/ +actions_dir = /usr/share/plinth/actions +doc_dir = /usr/share/doc/plinth # file locations store_file = %(data_dir)s/store.sqlite3 diff --git a/plinth/cfg.py b/plinth/cfg.py index 3f8b687b5..27c32c1e7 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -13,6 +13,7 @@ data_dir = None store_file = None user_db = None actions_dir = None +doc_dir = None status_log_file = None access_log_file = None pidfile = None @@ -44,6 +45,7 @@ def read(): ('Path', 'store_file'), ('Path', 'user_db'), ('Path', 'actions_dir'), + ('Path', 'doc_dir'), ('Path', 'status_log_file'), ('Path', 'access_log_file'), ('Path', 'pidfile'), diff --git a/plinth/modules/help/help.py b/plinth/modules/help/help.py index b3245dc89..4cbe8e893 100644 --- a/plinth/modules/help/help.py +++ b/plinth/modules/help/help.py @@ -36,7 +36,7 @@ def about(request): def helppage(request, page): """Serve a help page from the 'doc' directory""" try: - with open(os.path.join('doc', '%s.part.html' % page), 'r') \ + with open(os.path.join(cfg.doc_dir, '%s.part.html' % page), 'r') \ as input_file: main = input_file.read() except IOError: From b82fb629f074548786e9068bcd864b7a47812fc5 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:08:45 +0530 Subject: [PATCH 25/42] Remove use of python_root in cfg and use relative path --- plinth/cfg.py | 2 -- plinth/modules/packages/packages.py | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plinth/cfg.py b/plinth/cfg.py index 27c32c1e7..62263804a 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -8,7 +8,6 @@ product_name = None box_name = None root = None file_root = None -python_root = None data_dir = None store_file = None user_db = None @@ -40,7 +39,6 @@ def read(): ('Name', 'box_name'), ('Path', 'root'), ('Path', 'file_root'), - ('Path', 'python_root'), ('Path', 'data_dir'), ('Path', 'store_file'), ('Path', 'user_db'), diff --git a/plinth/modules/packages/packages.py b/plinth/modules/packages/packages.py index 8fe4cf6dc..b6c7a78c9 100644 --- a/plinth/modules/packages/packages.py +++ b/plinth/modules/packages/packages.py @@ -73,6 +73,7 @@ def get_status(): def _apply_changes(request, old_status, new_status): """Apply form changes""" + root = os.path.join(os.path.dirname(__file__), '..', '..') for field, enabled in new_status.items(): if not field.endswith('_enabled'): continue @@ -83,8 +84,8 @@ def _apply_changes(request, old_status, new_status): module = field.split('_enabled')[0] if enabled: try: - actions.superuser_run( - 'module-manager', ['enable', cfg.python_root, module]) + actions.superuser_run('module-manager', + ['enable', root, module]) except Exception: # TODO: need to get plinth to load the module we just # enabled @@ -97,8 +98,8 @@ def _apply_changes(request, old_status, new_status): module=module)) else: try: - actions.superuser_run( - 'module-manager', ['disable', cfg.python_root, module]) + actions.superuser_run('module-manager', + ['disable', root, module]) except Exception: # TODO: need a smoother way for plinth to unload the # module From 8a6bf129f31c1c97a9b066ed2af29d7ec50e932d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:09:14 +0530 Subject: [PATCH 26/42] Fix file_root in installed plinth.config --- data/etc/plinth/plinth.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config index 95d443267..216a273f0 100644 --- a/data/etc/plinth/plinth.config +++ b/data/etc/plinth/plinth.config @@ -4,7 +4,7 @@ box_name = FreedomBox [Path] # directory locations -file_root = /usr/share/plinth/static +file_root = /usr/share/plinth data_dir = /var/lib/plinth log_dir = /var/log/plinth pid_dir = /var/run From 9d296a6270224ad5da2568ebc90dcd680c578213 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:09:37 +0530 Subject: [PATCH 27/42] Update name of PID file to plinth.pid --- data/etc/plinth/plinth.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config index 216a273f0..3a87150e3 100644 --- a/data/etc/plinth/plinth.config +++ b/data/etc/plinth/plinth.config @@ -17,7 +17,7 @@ store_file = %(data_dir)s/store.sqlite3 user_db = %(data_dir)s/users.sqlite3 status_log_file = %(log_dir)s/status.log access_log_file = %(log_dir)s/access.log -pidfile = %(pid_dir)s/pidfile.pid +pidfile = %(pid_dir)s/plinth.pid [Network] host = 127.0.0.1 From ddb3b0f2c21390aac268a417588fbee684b4274e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:11:27 +0530 Subject: [PATCH 28/42] Use setup.py instead of Makefile --- Makefile | 93 ------------------------------------------- doc/Makefile | 2 +- setup.py | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 94 deletions(-) delete mode 100644 Makefile create mode 100755 setup.py diff --git a/Makefile b/Makefile deleted file mode 100644 index 59c53dab5..000000000 --- a/Makefile +++ /dev/null @@ -1,93 +0,0 @@ -MAKE=make - -PWD=`pwd` - -# hosting variables -SLEEP_TIME=300 -EXCLUDE=--exclude=*.tar.gz --exclude=*~ $(EXCLUDE-FILES) -ALL_BUT_GZ=$(subst $(wildcard *.tar.gz),,$(wildcard *)) -DATADIR=/usr/share/plinth -PYDIR=$(DATADIR)/python/plinth - -## Catch-all targets -default: config dirs docs -all: default - -predepend: - sudo sh -c "apt-get install pandoc psmisc python2.7 python-bcrypt python-cherrypy3 python-django python-passlib python-bootstrapform libjs-twitter-bootstrap sudo" - git submodule init - git submodule update - touch predepend - -install: default apache-install freedombox-setup-install - mkdir -p $(DESTDIR)/etc/init.d $(DESTDIR)/etc/plinth - cp plinth.sample.config $(DESTDIR)/etc/plinth/plinth.config - mkdir -p $(DESTDIR)$(PYDIR) $(DESTDIR)$(DATADIR) $(DESTDIR)/usr/bin \ - $(DESTDIR)/usr/share/doc/plinth $(DESTDIR)/usr/share/man/man1 - cp -a static themes $(DESTDIR)$(DATADIR)/ - cp -a actions $(DESTDIR)$(DATADIR)/ - cp -a sudoers.d $(DESTDIR)/etc/sudoers.d - cp -a *.py modules templates $(DESTDIR)$(PYDIR)/ - cp share/init.d/plinth $(DESTDIR)/etc/init.d - cp -a lib/* $(DESTDIR)/usr/lib - install plinth $(DESTDIR)/usr/bin/ - mkdir -p $(DESTDIR)/var/lib/plinth/sessions $(DESTDIR)/var/log/plinth $(DESTDIR)/var/run - mkdir -p $(DESTDIR)/var/lib/plinth/data - rm -f $(DESTDIR)/var/lib/plinth/users/sqlite3.distrib - -freedombox-setup-install: - install -m755 -D setup.d/86_plinth $(DESTDIR)/usr/lib/freedombox/setup.d/86_plinth - -uninstall: - rm -rf $(DESTDIR)/usr/lib/python2.7/plinth $(DESTDIR)/usr/share/plinth/ \ - $(DESTDIR)/etc/plinth $(DESTDIR)/var/lib/plinth $(DESTDIR)/usr/share/doc/plinth/ \ - $(DESTDIR)/var/log/plinth - rm -f $(DESTDIR)/usr/bin/plinth $(DESTDIR)/etc/init.d/plinth \ - $(DESTDIR)/usr/share/man/man1/plinth.1.gz $(DESTDIR)/var/run/plinth.pid - -dirs: - @mkdir -p data/sessions - -config: Makefile - @test -f plinth.config || cp plinth.sample.config plinth.config - -docs: - @$(MAKE) -s -C doc -doc: docs - -html: - @$(MAKE) -s -C doc html - -clean: - @rm -f cherrypy.config data/sessions/* - @find . -name "*~" -exec rm {} \; - @find . -name ".#*" -exec rm {} \; - @find . -name "#*" -exec rm {} \; - @find . -name "*.pyc" -exec rm {} \; - @find . -name "*.bak" -exec rm {} \; - @$(MAKE) -s -C doc clean - rm -f plinth.config - rm -f predepend - -hosting: - bash start.sh & - while [ 1 ]; do make current-checkout.tar.gz current-repository.tar.gz; sleep $(SLEEP_TIME); done - -current-checkout.tar.gz: $(ALL_BUT_GZ) - tar cz $(EXCLUDE) * > current-checkout.tar.gz - -current-repository.tar.gz: $(ALL_BUT_GZ) - tar cz $(EXCLUDE) * .git > current-repository.tar.gz - -apache-install: - install -D -m644 share/apache2/plinth.conf $(DESTDIR)/etc/apache2/sites-available/plinth.conf - install -D -m644 share/apache2/plinth-ssl.conf $(DESTDIR)/etc/apache2/sites-available/plinth-ssl.conf -apache-config: apache-install apache-modules - a2ensite plinth - a2ensite plinth-ssl - service apache2 reload - -apache-modules: -# enable all required modules, create snakeoil cert. - ./setup.d/86_plinth - service apache2 restart diff --git a/doc/Makefile b/doc/Makefile index d66ddd3db..0243a07aa 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -42,7 +42,7 @@ $(SOURCES): @rm -f $@ @ln -s ../$(patsubst %.mdwn,%,$@) $@ -../TODO : $(TODO_SOURCES) ../Makefile Makefile +../TODO : $(TODO_SOURCES) Makefile grep -ro --exclude=.git* --exclude=plinth.1 --exclude=*.tex --exclude=*.html \ --exclude=README.mdwn --exclude=INSTALL.mdwn \ --exclude=TODO.mdwn --exclude=COPYING.mdwn \ diff --git a/setup.py b/setup.py new file mode 100755 index 000000000..c724f32ae --- /dev/null +++ b/setup.py @@ -0,0 +1,110 @@ +#!/usr/bin/python +# +# This file is part of Plinth. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +""" +Plinth setup file +""" + +from distutils import log +from distutils.command.install_data import install_data +import glob +import os +from setuptools import find_packages, setup +import shutil + +from plinth import __version__ + + +DIRECTORIES_TO_CREATE = [ + '/var/lib/plinth', + '/var/lib/plinth/sessions', + '/var/log/plinth', +] + +DIRECTORIES_TO_COPY = [ + ('/usr/share/plinth/static', 'static'), + ('/usr/share/doc/plinth/', 'doc'), +] + + +class CustomInstallData(install_data): + """Override install command to allow directory creation""" + def run(self): + """Execute install command""" + install_data.run(self) # Old style base class + + # Create empty directories + for directory in DIRECTORIES_TO_CREATE: + if not os.path.exists(directory): + log.info("creating directory '%s'", directory) + os.makedirs(directory) + + # Recursively copy directories + for target, source in DIRECTORIES_TO_COPY: + if not os.path.exists(target): + log.info("recursive copy '%s' to '%s'", source, target) + shutil.copytree(source, target) + + +setup( + name='Plinth', + version=__version__, + description='A web front end for administering FreedomBox', + url='http://freedomboxfoundation.org', + packages=find_packages(), + scripts=['bin/plinth'], + license='COPYING', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Web Environment', + 'Framework :: Django', + 'Intended Audience :: End Users/Desktop', + 'License :: DFSG approved', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python', + 'Programming Language :: Unix Shell', + 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', + 'Topic :: System :: Systems Administration', + ], + install_requires=[ + 'cherrypy >= 3.0', + 'django >= 1.6.0', + 'django-bootstrap-form', + 'withsqlite', + ], + package_data={'plinth': ['modules/enabled/*', + 'templates/*', + 'modules/*/templates/*']}, + data_files=[('/etc/init.d', ['data/etc/init.d/plinth']), + ('/usr/lib/freedombox/setup.d/', + ['data/usr/lib/freedombox/setup.d/86_plinth']), + ('/usr/lib/freedombox/first-run.d', + ['data/usr/lib/freedombox/first-run.d/90_firewall']), + ('/etc/apache2/sites-available', + ['data/etc/apache2/sites-available/plinth.conf', + 'data/etc/apache2/sites-available/plinth-ssl.conf']), + ('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']), + ('/usr/share/plinth/actions', + glob.glob(os.path.join('actions', '*'))), + ('/usr/share/man/man1', ['doc/plinth.1']), + ('/etc/plinth', ['data/etc/plinth/plinth.config'])], + cmdclass={'install_data': CustomInstallData}, +) From cf61ba3c6e129280c5f558a6d892997bff731f99 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:11:57 +0530 Subject: [PATCH 29/42] Update LICENSES file with new file paths --- LICENSES | 121 +++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 67 deletions(-) diff --git a/LICENSES b/LICENSES index 06d7d8122..982810416 100644 --- a/LICENSES +++ b/LICENSES @@ -4,27 +4,12 @@ For each of the files listed, the copyright specified for the file is listed. "-" means "no license specified in the file," licenses are specified and linked otherwise. -- actions.py :: - -- cfg.py :: - - COPYING :: N/A -- COPYRIGHTS :: N/A -- fabfile.py :: - - INSTALL :: - -- logger.py :: - -- Makefile :: - -- menu.py :: - - NOTES :: - -- plinth :: - - plinth.config :: - -- plinth.py :: [[file:plinth.py::__license__%20%3D%20"GPLv3%20or%20later"]["GPLv3 or later"]] -- plinth.sample.config :: - - README :: - -- start.sh :: - -- test.sh :: - - TODO :: - -- util.py :: different parts under different licenses: - - [[file:util.py::def%20mkdir(newdir):][def mkdir(newdir):]] :: [[http://code.activestate.com/recipes/82465/][mkdir]] (PSF license), should be replaced with =os.makedirs()= - - other parts :: - - actions/echo :: - - actions/hostname-change :: - - actions/id :: - @@ -32,6 +17,11 @@ specified and linked otherwise. - actions/timezone-change :: - - actions/xmpp-register :: - - actions/xmpp-setup :: - +- data/usr/lib/freedombox/setup.d/86_plinth :: - +- data/etc/apache2/plinth.conf :: - +- data/etc/apache2/plinth-ssl.conf :: - +- data/etc/init.d/plinth :: - +- data/etc/sudoers.d/plinth :: - - doc/colophon.mdwn :: - - doc/faq.mdwn :: - - doc/footer.html :: - @@ -42,55 +32,52 @@ specified and linked otherwise. - doc/scripts.mdwn :: - - doc/security.mdwn :: - - doc/themes.mdwn :: - -- modules/apps/apps.py :: - -- modules/config/config.py :: - -- modules/diagnostics/diagnostics.py :: - -- modules/expert_mode/expert_mode.py :: - -- modules/first_boot/first_boot.py :: - -- modules/help/help.py :: - -- modules/lib/auth.py :: - -- modules/owncloud/owncloud.py :: - -- modules/packages/packages.py :: - -- modules/santiago/santiago.py :: - -- modules/system/system.py :: - -- modules/tor/tor.py :: - -- modules/users/users.py :: - -- modules/xmpp/xmpp.py :: - -- setup/86_plinth :: - -- share/apache2/plinth.conf :: - -- share/apache2/plinth-ssl.conf :: - -- share/init.d/plinth :: - -- sudoers/plinth :: - -- templates/base.html :: [[file:templates/base.tmpl::the%20GNU%20Affero%20General%20Public][GNU Affero General Public License, Version 3 or later]] -- tests/actions_test.py :: - -- tests/auth_test.py :: - -- tests/testdata/users.sqlite3 :: - -- tests/user_store_test.py :: - -- themes/default/FreedomBox-Identity-Manual.pdf :: - -- themes/default/FreedomBox-Logo.7z :: [[http://thread.gmane.org/gmane.linux.debian.freedombox.user/4124/focus=4439][GPL3+/CC-BY-SA]] -- themes/default/readme.md :: [[file:themes/default/readme.md::This%20theme%20is%20free%20software%20offered%20to%20you%20under%20the%20terms%20of%20the%20GNU%20Affero%20General%20Public%20License,%20Version%203%20or%20later:][GNU Affero General Public License Version 3]] -- themes/default/screenshot.png :: - -- themes/default/img/apple-touch-icon-114px-precomposed.png :: - -- themes/default/img/apple-touch-icon-57px-precomposed.png :: - -- themes/default/img/apple-touch-icon-72px-precomposed.png :: - -- themes/default/img/apple-touch-icon.xcf :: - -- themes/default/img/favicon-32px.ico :: - -- themes/default/img/favicon.ico :: - -- themes/default/img/freedombox-logo-200px.png :: - -- themes/default/img/freedombox-logo-250px.png :: - -- themes/default/img/freedombox-logo-32px.png :: - -- themes/default/img/FreedomBox-logo-grayscale-negative.png :: - -- themes/default/img/FreedomBox-logo-grayscale-negative.svg :: - -- themes/default/img/FreedomBox-logo-grayscale.png :: - -- themes/default/img/FreedomBox-logo-grayscale.svg :: - -- themes/default/img/FreedomBox-logo-lineart-negative.png :: - -- themes/default/img/FreedomBox-logo-lineart-negative.svg :: - -- themes/default/img/FreedomBox-logo-lineart.png :: - -- themes/default/img/FreedomBox-logo-lineart.svg :: - -- themes/default/img/FreedomBox-logo-standard.png :: - -- themes/default/img/FreedomBox-logo-standard.svg :: - -- themes/default/img/freedombox-logotype.png :: - -- themes/default/img/glyphicons-halflings.png :: - -- themes/default/img/glyphicons-halflings-white.png :: - -- themes/default/js/libs/jquery.min.js :: Symlink to external target: [[file:themes/default/js/libs/jquery.min.js::*%20Dual%20licensed%20under%20the%20MIT%20or%20GPL%20Version%202%20licenses.][MIT/GPL2]] -- themes/default/js/libs/modernizr.min.js :: Symlink to external target: MIT +- plinth/__main__.py :: [[file:plinth.py::__license__%20%3D%20"GPLv3%20or%20later"]["GPLv3 or later"]] +- plinth/actions.py :: - +- plinth/cfg.py :: - +- plinth/logger.py :: - +- plinth/menu.py :: - +- plinth/modules/apps/apps.py :: - +- plinth/modules/config/config.py :: - +- plinth/modules/diagnostics/diagnostics.py :: - +- plinth/modules/expert_mode/expert_mode.py :: - +- plinth/modules/first_boot/first_boot.py :: - +- plinth/modules/help/help.py :: - +- plinth/modules/lib/auth.py :: - +- plinth/modules/owncloud/owncloud.py :: - +- plinth/modules/packages/packages.py :: - +- plinth/modules/santiago/santiago.py :: - +- plinth/modules/system/system.py :: - +- plinth/modules/tor/tor.py :: - +- plinth/modules/users/users.py :: - +- plinth/modules/xmpp/xmpp.py :: - +- plinth/templates/base.html :: [[file:templates/base.tmpl::the%20GNU%20Affero%20General%20Public][GNU Affero General Public License, Version 3 or later]] +- plinth/tests/actions_test.py :: - +- static/themes/default/FreedomBox-Identity-Manual.pdf :: - +- static/themes/default/FreedomBox-Logo.7z :: [[http://thread.gmane.org/gmane.linux.debian.freedombox.user/4124/focus=4439][GPL3+/CC-BY-SA]] +- static/themes/default/readme.md :: [[file:themes/default/readme.md::This%20theme%20is%20free%20software%20offered%20to%20you%20under%20the%20terms%20of%20the%20GNU%20Affero%20General%20Public%20License,%20Version%203%20or%20later:][GNU Affero General Public License Version 3]] +- static/themes/default/screenshot.png :: - +- static/themes/default/img/apple-touch-icon-114px-precomposed.png :: - +- static/themes/default/img/apple-touch-icon-57px-precomposed.png :: - +- static/themes/default/img/apple-touch-icon-72px-precomposed.png :: - +- static/themes/default/img/apple-touch-icon.xcf :: - +- static/themes/default/img/favicon-32px.ico :: - +- static/themes/default/img/favicon.ico :: - +- static/themes/default/img/freedombox-logo-200px.png :: - +- static/themes/default/img/freedombox-logo-250px.png :: - +- static/themes/default/img/freedombox-logo-32px.png :: - +- static/themes/default/img/FreedomBox-logo-grayscale-negative.png :: - +- static/themes/default/img/FreedomBox-logo-grayscale-negative.svg :: - +- static/themes/default/img/FreedomBox-logo-grayscale.png :: - +- static/themes/default/img/FreedomBox-logo-grayscale.svg :: - +- static/themes/default/img/FreedomBox-logo-lineart-negative.png :: - +- static/themes/default/img/FreedomBox-logo-lineart-negative.svg :: - +- static/themes/default/img/FreedomBox-logo-lineart.png :: - +- static/themes/default/img/FreedomBox-logo-lineart.svg :: - +- static/themes/default/img/FreedomBox-logo-standard.png :: - +- static/themes/default/img/FreedomBox-logo-standard.svg :: - +- static/themes/default/img/freedombox-logotype.png :: - +- static/themes/default/img/glyphicons-halflings.png :: - +- static/themes/default/img/glyphicons-halflings-white.png :: - +- static/themes/default/js/libs/jquery.min.js :: Symlink to external target: [[file:themes/default/js/libs/jquery.min.js::*%20Dual%20licensed%20under%20the%20MIT%20or%20GPL%20Version%202%20licenses.][MIT/GPL2]] +- static/themes/default/js/libs/modernizr.min.js :: Symlink to external target: MIT From e627c1795b6389db6c4d1ca07b2463eac19bc2ed Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:14:32 +0530 Subject: [PATCH 30/42] Ability to read configuration from system or working directory --- plinth/cfg.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plinth/cfg.py b/plinth/cfg.py index 62263804a..595841fee 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -24,16 +24,25 @@ server_dir = '/' main_menu = Menu() +DEFAULT_CONFIG_FILE = '/etc/plinth/plinth.config' +DEFAULT_ROOT = '/' + def read(): """Read configuration""" - directory = os.path.dirname(os.path.realpath(__file__)) - directory = os.path.join(directory, '..') + if os.path.isfile(DEFAULT_CONFIG_FILE): + config_file = DEFAULT_CONFIG_FILE + directory = DEFAULT_ROOT + else: + directory = os.path.dirname(os.path.realpath(__file__)) + directory = os.path.join(directory, '..') + config_file = os.path.join(directory, 'plinth.config') + parser = SafeConfigParser( defaults={ 'root': directory, }) - parser.read(os.path.join(directory, 'plinth.config')) + parser.read(config_file) config_items = {('Name', 'product_name'), ('Name', 'box_name'), From f4edfdedc6057dc8e06feb00edd0e812e380a90e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:17:37 +0530 Subject: [PATCH 31/42] Fix first boot middleware for new module structure --- plinth/__main__.py | 2 +- plinth/modules/first_boot/middleware.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index b418b2b26..e62508f7f 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -189,7 +189,7 @@ def configure_django(): 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'modules.first_boot.middleware.FirstBootMiddleware', + 'plinth.modules.first_boot.middleware.FirstBootMiddleware', ), ROOT_URLCONF='plinth.urls', SESSION_ENGINE='django.contrib.sessions.backends.file', diff --git a/plinth/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py index 17ae7c734..ee7d7f5db 100644 --- a/plinth/modules/first_boot/middleware.py +++ b/plinth/modules/first_boot/middleware.py @@ -24,7 +24,7 @@ from django.core.urlresolvers import reverse from django.http.response import HttpResponseRedirect import logging -import cfg +from plinth import cfg from withsqlite.withsqlite import sqlite_db From 6d3170ece41e201723a91e3194de36a2d8b27ba7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 13:18:09 +0530 Subject: [PATCH 32/42] Use os.path.join() for creating a static directory path --- plinth/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index e62508f7f..4910ce8d0 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -92,7 +92,7 @@ def setup_server(): cherrypy.tree.graft(application, cfg.server_dir) config = { - '/': {'tools.staticdir.root': '%s/static' % cfg.file_root, + '/': {'tools.staticdir.root': os.path.join(cfg.file_root, 'static'), 'tools.staticdir.on': True, 'tools.staticdir.dir': '.'}} cherrypy.tree.mount(None, django.conf.settings.STATIC_URL, config) From 4cc2dc45468eaf3783d7952c8eff060f678a661f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 14:24:00 +0530 Subject: [PATCH 33/42] Launch test cases using "setup.py test" --- plinth/tests/__init__.py | 26 ++++++++++++++++++++++++++ setup.py | 1 + test | 28 ---------------------------- 3 files changed, 27 insertions(+), 28 deletions(-) delete mode 100755 test diff --git a/plinth/tests/__init__.py b/plinth/tests/__init__.py index e69de29bb..656350883 100644 --- a/plinth/tests/__init__.py +++ b/plinth/tests/__init__.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# +# This file is part of Plinth. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +""" +Module initializer for Plinth test cases containing test suite +""" + +import unittest + + +TEST_SUITE = unittest.defaultTestLoader.discover('plinth.tests') diff --git a/setup.py b/setup.py index c724f32ae..d75d0d041 100755 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ setup( url='http://freedomboxfoundation.org', packages=find_packages(), scripts=['bin/plinth'], + test_suite='plinth.tests.TEST_SUITE', license='COPYING', classifiers=[ 'Development Status :: 3 - Alpha', diff --git a/test b/test deleted file mode 100755 index 47a9728fd..000000000 --- a/test +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python -# -# This file is part of Plinth. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# - -""" -Script to run Plinth test cases -""" - -import unittest - - -if __name__ == '__main__': - test_suite = unittest.defaultTestLoader.discover('plinth.tests') - unittest.TextTestRunner().run(test_suite) From 472ffce68a93b29078399a8bac5298e11517e3dc Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 16:13:21 +0530 Subject: [PATCH 34/42] Update URL for reporting issues --- plinth/templates/404.html | 2 +- plinth/templates/500.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plinth/templates/404.html b/plinth/templates/404.html index 8c0fcc69c..23c06b8bf 100644 --- a/plinth/templates/404.html +++ b/plinth/templates/404.html @@ -27,7 +27,7 @@

Requested page {{ request_path }} was not found.

If you believe this missing page should exist, please file a bug with either - the Plinth project (it + the Plinth project (it has an issue tracker) or the people responsible for the module you are trying to access.

diff --git a/plinth/templates/500.html b/plinth/templates/500.html index 0863ec630..7dd5e8244 100644 --- a/plinth/templates/500.html +++ b/plinth/templates/500.html @@ -26,7 +26,7 @@

This is an internal error and not something you caused or can fix. Please report the error on - the bug tracker so we - can fix it.

+ the bug tracker so + we can fix it.

{% endblock %} From 4625bc55dfa2204b499d80205db3ead3eca39d51 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 16:23:50 +0530 Subject: [PATCH 35/42] Remove unused user_dir config variable --- data/etc/plinth/plinth.config | 1 - plinth.config | 1 - plinth/cfg.py | 6 ------ 3 files changed, 8 deletions(-) diff --git a/data/etc/plinth/plinth.config b/data/etc/plinth/plinth.config index 3a87150e3..cf89d43c9 100644 --- a/data/etc/plinth/plinth.config +++ b/data/etc/plinth/plinth.config @@ -14,7 +14,6 @@ doc_dir = /usr/share/doc/plinth # file locations store_file = %(data_dir)s/store.sqlite3 -user_db = %(data_dir)s/users.sqlite3 status_log_file = %(log_dir)s/status.log access_log_file = %(log_dir)s/access.log pidfile = %(pid_dir)s/plinth.pid diff --git a/plinth.config b/plinth.config index e13312dad..193d18c72 100644 --- a/plinth.config +++ b/plinth.config @@ -14,7 +14,6 @@ doc_dir = %(file_root)s/doc # file locations store_file = %(data_dir)s/store.sqlite3 -user_db = %(data_dir)s/users.sqlite3 status_log_file = %(log_dir)s/status.log access_log_file = %(log_dir)s/access.log pidfile = %(pid_dir)s/plinth.pid diff --git a/plinth/cfg.py b/plinth/cfg.py index 595841fee..9e394f591 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -10,7 +10,6 @@ root = None file_root = None data_dir = None store_file = None -user_db = None actions_dir = None doc_dir = None status_log_file = None @@ -50,7 +49,6 @@ def read(): ('Path', 'file_root'), ('Path', 'data_dir'), ('Path', 'store_file'), - ('Path', 'user_db'), ('Path', 'actions_dir'), ('Path', 'doc_dir'), ('Path', 'status_log_file'), @@ -74,7 +72,3 @@ def read(): global store_file # pylint: disable-msg=W0603 if store_file.endswith(".sqlite3"): store_file = os.path.splitext(store_file)[0] - - global user_db # pylint: disable-msg=W0603 - if user_db.endswith(".sqlite3"): - user_db = os.path.splitext(user_db)[0] From f243dfa3abd5ec3998178cb3e62acbc3257f7e37 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 16:32:11 +0530 Subject: [PATCH 36/42] Allow running from working directory --- .gitignore | 11 ++++------- data/var/lib/plinth/.gitkeep | 0 data/var/lib/plinth/sessions/.gitkeep | 0 data/var/log/plinth/.gitkeep | 0 data/var/run/.gitkeep | 0 plinth.config | 8 ++++---- plinth/__main__.py | 2 +- plinth/cfg.py | 2 +- 8 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 data/var/lib/plinth/.gitkeep create mode 100644 data/var/lib/plinth/sessions/.gitkeep create mode 100644 data/var/log/plinth/.gitkeep create mode 100644 data/var/run/.gitkeep diff --git a/.gitignore b/.gitignore index 6c43468cd..440e2c916 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,11 @@ -current-*.tar.gz *.pyc *.py.bak *.swp *.tiny.css -data/*.log -data/cherrypy_sessions -data/sessions -data/store.sqlite3 +data/var/log/plinth/*.log +data/var/lib/plinth/*.sqlite3 +data/var/lib/plinth/sessions/* +data/var/run/*.pid doc/*.tex doc/*.pdf doc/*.html @@ -24,10 +23,8 @@ TODO \#* .#* *~ -data/plinth.sqlite3 predepend build/ -*.pid .emacs.desktop* *.egg-info/ dist/ diff --git a/data/var/lib/plinth/.gitkeep b/data/var/lib/plinth/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/data/var/lib/plinth/sessions/.gitkeep b/data/var/lib/plinth/sessions/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/data/var/log/plinth/.gitkeep b/data/var/log/plinth/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/data/var/run/.gitkeep b/data/var/run/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/plinth.config b/plinth.config index 193d18c72..8aeb93ba6 100644 --- a/plinth.config +++ b/plinth.config @@ -5,10 +5,10 @@ box_name = FreedomBox [Path] # directory locations file_root = %(root)s -data_dir = %(file_root)s/data -log_dir = %(data_dir)s -pid_dir = %(data_dir)s -server_dir = 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 +server_dir = / actions_dir = %(file_root)s/actions doc_dir = %(file_root)s/doc diff --git a/plinth/__main__.py b/plinth/__main__.py index 4910ce8d0..9fee788c3 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -194,7 +194,7 @@ def configure_django(): ROOT_URLCONF='plinth.urls', SESSION_ENGINE='django.contrib.sessions.backends.file', SESSION_FILE_PATH=sessions_directory, - STATIC_URL=cfg.server_dir + '/static/', + STATIC_URL='/'.join([cfg.server_dir, 'static/']).replace('//', '/'), TEMPLATE_CONTEXT_PROCESSORS=context_processors, TEMPLATE_DIRS=template_directories) diff --git a/plinth/cfg.py b/plinth/cfg.py index 9e394f591..54b801ea7 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -39,7 +39,7 @@ def read(): parser = SafeConfigParser( defaults={ - 'root': directory, + 'root': os.path.realpath(directory), }) parser.read(config_file) From 9b6034728212f16e251db5f32c7140ef0204d0d4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 17:11:42 +0530 Subject: [PATCH 37/42] Update documenation on installating and developing Plinth --- HACKING | 112 +++++++++++++++++++++++++++++++++++++++++++++++ INSTALL | 51 ++++++--------------- doc/hacking.mdwn | 103 +------------------------------------------ 3 files changed, 127 insertions(+), 139 deletions(-) create mode 100644 HACKING mode change 100644 => 120000 doc/hacking.mdwn diff --git a/HACKING b/HACKING new file mode 100644 index 000000000..a014065e3 --- /dev/null +++ b/HACKING @@ -0,0 +1,112 @@ +# Hacking + +## Installing for Development + +1. Instead of running "setup.py install" after every source modification, run + the following command: + + $ sudo python setup.py develop + + This will install the python package in a special development mode. Run it + normally. Any updates to the code (and core pakcage data files) do not + require re-installation after every modification. + + CherryPy web server also monitors changes to the source files and reloads + the server as soon as a file is modified. Hence it is usually sufficient + to modify the source and refresh the browser page to see the changes. + +2. Plinth also support running without installing (as much as possible). + Simply run it as: + + $ sudo python -m plinth + + In this mode, Plinth runs in working directory without need for + installation. It uses a different config file (plinth.conf in working + directory) instead of the regular config file (/etc/plinth/plinth.conf). It + creates all that data and runtime files in data/var/*. To make Plinth + pickup the config file in working directory, simply delete + /etc/plinth/plinth.config. + +## Running Tests + +1. Run tests: + + $ python setup.py test + +## Testing Inside a Virtual Machine + +1. Checkout source on the host. + +2. Share the source folder and mount it on virtual machine. This could be done + over NFS, SSH-fs or 'Shared Folders' feature on VirtualBox. + +3. Run 'setup.py develop' or 'setup.py install' as described above on guest + machine. + +4. Access the guest machine's Plinth web UI from host after setting bridging or + NATing for guest virtual machine. + +## Building the Documentation Separately + +Documentation has been collected into a PDF. It also gets built into smaller +files and other formats, including one suitable for install as a man page. + +1. To build the documentation separately, run: + + $ make -C doc + +## Repository + +Plinth is available from [GitHub](https://github.com/freedombox/plinth). + +## Bugs & TODO + +You can report bugs on Plinth's +[issue tracker](https://github.com/freedombox/Plinth/issues). + +Feel free to pickup a task by announcing it on the issue. Once you are done, +request a merge. For information on placing a merge request, consult GitHub +documentation. + +## Coding Practices + +Plinth confirms to [PEP 8](http://www.python.org/dev/peps/pep-0008/) Python +coding standard. You should check your code with *pep8* and *pylint* tools +before placing a merge request. + +## Internationalization + +Every module should `from gettext import gettext as _` and wrap +displayed strings with _(). We don't have the language stuff in place +yet (we have no translation files), but we need to put the +infrastructure in place for it from the start. Use it like this: + + log.error(_("Couldn't import %s: %s"), path, e) + +## Dependencies + +* *Bootstrap Form* - Render Django forms for Twitter Bootstrap + +* *CherryPy3* - WSGI web server since Django does not have proper web server + +* *Django* - Web application framework for Plinth + +* *JQuery* - Javascript framework used for convenience + +* *Modernizer* - HTML5 and CSS3 feature detection + +* *Python* - tested with version 2.7 + +* *Twitter Bootstrap* - A responsive, mobile first front-end framework + +* *Withsqlite* - Python library that stores dictionaries in sqlite3 + +The documentation has the following dependencies: + +* *Markdown* - format and style docs + +* *Pandoc* - Convert markdown to various formats + +* *PDFLatex* - Generate PDF versions of the documentation + +* *GNU Make* - Process doc/Makefile. diff --git a/INSTALL b/INSTALL index d9c8bd94b..6b131484d 100644 --- a/INSTALL +++ b/INSTALL @@ -1,47 +1,24 @@ -# Quick Start +# Installing Plinth -## Installing Plinth +1. Install the dependencies: -Install the dependencies: + On a Debian based system, run: -apt-get install pandoc psmisc python2.7 python-cherrypy3 python-django python-bootstrapform libjs-twitter-bootstrap sudo + $ sudo apt-get install libjs-jquery libjs-modernizer \ + libjs-twitter-bootstrap make pandoc python2.7 python-cherrypy3 \ + python-django python-bootstrapform python-withsqlite -Unzip and untar the source into a directory. Change to the directory -containing the program. Run: +2. Install Plinth: - $ make + Unzip the source into a directory. Change to the directory containing the + program and run: -To start Plinth, run: + $ sudo python setup.py install - $ ./start.sh +3. Run Plinth: -and point your web browser at `localhost:8000`. The default username is "admin" -and the default password is "secret". + $ sudo plinth -## Dependencies +4. Access Plinth UI: -* cherrypy - python web engine v3+ - -* python - tested with version 2.6.6 - -* *GNU Make* is used to build the templates and such. - -* *libjs-twitter-bootstrap* - A responsive, mobile first front-end framework - -* *python-bootstrapform* - Render django forms for Twitter Bootstrap - -The documentation has some dependencies too. - -* *Markdown* is used to format and style docs. - -* *Pandoc* converts the markdown to different formats. - -* *PDFLatex* generates pdf versions of the documentation. - -* *GNU Make* processes /doc/Makefile. - -## Building the Documentation - -Documentation has been collected into a pdf that can be built using -`make doc`. It also gets built into smaller files and other formats, -including one suitable for install as a man page. + Plinth UI should be accessible at http://localhost:8000 diff --git a/doc/hacking.mdwn b/doc/hacking.mdwn deleted file mode 100644 index a334fc51b..000000000 --- a/doc/hacking.mdwn +++ /dev/null @@ -1,102 +0,0 @@ -# Hacking - -This codebase could really use a testing framework. - -If you are interested in helping out, writing tests is a great place -to start-- you don't need to know much about the code or python to -write useful tests. - -In addition to a testing framework, the code is in need of some -general cleanup. I've been inconsistent in capitalization conventions -as well as in my use of underscores. - -The plugin interface could use some attention as well. Right now, -it's a a bit of a free-for-all until I see how the plugins actually -code up. Channeling all that into a few plugin interface grooves -would be a help. - -If you're feeling more ambitious than that, the best way to improve -Plinth is to add modules. More functionality, especially in the -router section, could convert the Freedom Box from a good idea to a -must-have appliance. - -Beyond that, we need to train some expert eyes on the interaction -between Freedom Boxes. Transparent, zero-config box-to-box backup is -possible. We just need to build an auth and dns layer. There are -lots of theories on how to do this well. The first theory reduced to -practice wins! - -There is a list of TODO items below. Some of them are discrete pieces -that can be tackled without diving too deep into the code. - -## Repository - -Plinth is available from github at -`git://github.com/jvasile/plinth.git`. The [project page on -github](https://github.com/jvasile/plinth) is at -`https://github.com/jvasile/plinth`. - -## Bugs - -There are lots of bugs. We don't have a spec or tests, so a bug is -really just any unexpected behavior. I am not easily surprised, but -there are still lots of bugs. - -There's an [issue tracker](https://github.com/jvasile/Plinth/issues). -Please add things and consult it for things to tackle. - - - -## Coding Practices - -I try to stick to [PEP 8](http://www.python.org/dev/peps/pep-0008/) -recommendations. That's not to say I don't deviate, just that -deviations are usually bugs that should be fixed. - -### Internationalization - -Every module should `from gettext import gettext as _` and wrap -displayed strings with _(). We don't have the language stuff in place -yet (we have no translation files), but we need to put the -infrastructure in place for it from the start. Use it like this: - - cfg.log.error(_("Couldn't import %s: %s") % (path, e)) - -### Variables and Data Stores - -Plinth needs to keep information for short and long term -future use, and it can't just store all of that on the stack. - -Global config information can be put in the `cfg` module namespace. -Keep it thread and session safe, though, or you'll get undefined -behavior as soon as multiple simultaneous users enter the picture. - -Cherrpy has support for session variables. Use those for short term -user-specific data. - -For long term storage, the Plinth needs a back end -storage solution. Databases are a bit opaque and can be hard for -third party software or shell users to manipulate. For now, I've -decided that persistent data should be placed in dicts and stored in -json format. We'll need a file locking solution too. - -The `user_store.py` module implements the `UserStoreModule` interface -specified in `plugin_mount.py`. Any new system that respects that -interface can be used. The existing `user_store.py` holds entire user -files in memory and caches user files as it goes. This has two -downsides: first, if you have lots of users and store big things in -the user dict, you'll run out of memory. Second, it's not thread -safe. Maybe a database is a good idea after all. - -We do not yet have a means of storing module data for long terms. My -current thinking is that modules can store data in their own -directories. That makes removal easy. - -## Todo - -Plinth has a number of open todo items. And there are items in the -[issue tracker](https://github.com/jvasile/Plinth/issues) that need -tackling. Please help! - -* Implement the functions in the submenus of router.py -* Unify our logging and cherrypy's. diff --git a/doc/hacking.mdwn b/doc/hacking.mdwn new file mode 120000 index 000000000..cc8063b39 --- /dev/null +++ b/doc/hacking.mdwn @@ -0,0 +1 @@ +../HACKING \ No newline at end of file From c62f0cfa7221ea8ca2c27ee8495c0842e02978c4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 17:35:21 +0530 Subject: [PATCH 38/42] Update README --- README => README.md | 20 +++++++++----------- doc/Makefile | 6 +++++- 2 files changed, 14 insertions(+), 12 deletions(-) rename README => README.md (85%) diff --git a/README b/README.md similarity index 85% rename from README rename to README.md index 6c8382b54..ad36e0c2a 100644 --- a/README +++ b/README.md @@ -1,6 +1,4 @@ -% PLINTH(1) Version 0.1 | Plinth User Manual -% -% February 2011 +% Plinth User Manual # Introduction @@ -8,10 +6,6 @@ plinth - a web front end for administering every aspect of a Freedom Box. -## Synopsis - -plinth.py - ## Description The Freedom Box is a net appliance conceived by Eben Moglen. It @@ -45,10 +39,14 @@ servers. Basic users should never even know those options exist. ## Getting Started -See the INSTALL file for additional details. Run: +See the INSTALL file for additional details and dependencies. To install run: - $ make + $ sudo python setup.py install -Once make finishes, run Plinth on the local system with: +Run Plinth on the local system with: - $ bash start.sh + $ sudo plinth + +## Contributing + +See the HACKING file for contributing to Plinth. diff --git a/doc/Makefile b/doc/Makefile index 0243a07aa..e6601e93d 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -40,7 +40,11 @@ oneline.txt: Makefile $(SOURCES): @rm -f $@ - @ln -s ../$(patsubst %.mdwn,%,$@) $@ + if [ -f ../$(patsubst %.mdwn,%.md,$@) ]; then \ + ln -s ../$(patsubst %.mdwn,%.md,$@) $@; \ + else \ + ln -s ../$(patsubst %.mdwn,%,$@) $@; \ + fi ../TODO : $(TODO_SOURCES) Makefile grep -ro --exclude=.git* --exclude=plinth.1 --exclude=*.tex --exclude=*.html \ From b12072d9245aaec0d242ee1d78118e9ad8d0e93a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 31 Aug 2014 18:29:21 +0530 Subject: [PATCH 39/42] Build documentation before install --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d75d0d041..823f6db00 100755 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ import glob import os from setuptools import find_packages, setup import shutil +import subprocess from plinth import __version__ @@ -41,11 +42,12 @@ DIRECTORIES_TO_COPY = [ ('/usr/share/doc/plinth/', 'doc'), ] - class CustomInstallData(install_data): - """Override install command to allow directory creation""" + """Override install command to allow directory creation and copy""" def run(self): """Execute install command""" + subprocess.check_call(['make', '-C', 'doc']) + install_data.run(self) # Old style base class # Create empty directories From 27cdadbc763a3ad953af45b6c7b126b0cc503703 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 2 Sep 2014 14:47:35 +0530 Subject: [PATCH 40/42] Log a message showing the config file used --- plinth/__main__.py | 3 ++- plinth/cfg.py | 10 ++++++---- setup.py | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index 9fee788c3..09dff24f3 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -7,7 +7,6 @@ import django.core.wsgi import logging import os import stat -import sys import cherrypy from cherrypy import _cpserver @@ -219,6 +218,8 @@ def main(): configure_django() + LOGGER.info('Configuration loaded from file - %s', cfg.CONFIG_FILE) + module_loader.load_modules() setup_server() diff --git a/plinth/cfg.py b/plinth/cfg.py index 54b801ea7..12a620fae 100644 --- a/plinth/cfg.py +++ b/plinth/cfg.py @@ -1,4 +1,4 @@ -from menu import Menu +from plinth.menu import Menu import os import ConfigParser @@ -23,25 +23,27 @@ server_dir = '/' main_menu = Menu() +CONFIG_FILE = None DEFAULT_CONFIG_FILE = '/etc/plinth/plinth.config' DEFAULT_ROOT = '/' def read(): """Read configuration""" + global CONFIG_FILE # pylint: disable-msg=W0603 if os.path.isfile(DEFAULT_CONFIG_FILE): - config_file = DEFAULT_CONFIG_FILE + CONFIG_FILE = DEFAULT_CONFIG_FILE directory = DEFAULT_ROOT else: directory = os.path.dirname(os.path.realpath(__file__)) directory = os.path.join(directory, '..') - config_file = os.path.join(directory, 'plinth.config') + CONFIG_FILE = os.path.join(directory, 'plinth.config') parser = SafeConfigParser( defaults={ 'root': os.path.realpath(directory), }) - parser.read(config_file) + parser.read(CONFIG_FILE) config_items = {('Name', 'product_name'), ('Name', 'box_name'), diff --git a/setup.py b/setup.py index 823f6db00..41967fad5 100755 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ DIRECTORIES_TO_COPY = [ ('/usr/share/doc/plinth/', 'doc'), ] + class CustomInstallData(install_data): """Override install command to allow directory creation and copy""" def run(self): From eb1777e185757c0cc898182fab957bc816752471 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 2 Sep 2014 17:55:49 +0530 Subject: [PATCH 41/42] Update information about run-without-install method --- HACKING | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/HACKING b/HACKING index a014065e3..6dcc5321d 100644 --- a/HACKING +++ b/HACKING @@ -18,7 +18,7 @@ 2. Plinth also support running without installing (as much as possible). Simply run it as: - $ sudo python -m plinth + $ sudo python -m plinth --no-daemon --debug In this mode, Plinth runs in working directory without need for installation. It uses a different config file (plinth.conf in working @@ -27,6 +27,17 @@ pickup the config file in working directory, simply delete /etc/plinth/plinth.config. + *Note:* This mode is supported only in a limited manner. The following are + the unknown issues with it: + + 1. It does not work without the --debug and --no-daemon flags. + + 2. Help pages are also not built. Run 'make -C doc' manaully. + + 3. Actions do not work when running as normal user without 'sudo' prefix. + You need to add 'actions' directory to be allowed for 'sudo' commands. + See data/etc/sudoers.d/plinth for a hint. + ## Running Tests 1. Run tests: From 7a649b6f818cdf880ef9f446857b74ee41684d38 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 2 Sep 2014 18:26:43 +0530 Subject: [PATCH 42/42] Remove duplicate, outdated version info from __main__.py --- plinth/__main__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index 09dff24f3..dcfc6cf0d 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -16,7 +16,6 @@ from plinth import cfg from plinth import module_loader from plinth import service -__version__ = "0.2.14" __author__ = "James Vasile" __copyright__ = "Copyright 2011-2013, James Vasile" __license__ = "GPLv3 or later"