*: Move modules-enabled files to /usr/share

- This will leave /etc/{plinth,freedombox} empty by default making service more
robust to run across various environments and situations. See systemd's
explanation for more details.

- Use Debian maintainer scripts remove all the existing files in
/etc/plinth/modules-enabled.

- Read from /usr/share/freedombox/modules-enabled then from
/etc/plinth/modules-enabled and finally from /etc/freedombox/modules-enabled.
Later read ones override previously read files. Any file pointing to /dev/null
will mean the module must be ignored.

Tests:

- Clean up /etc/plinth, /etc/freedombox and
/usr/share/freedombox/modules-enabled. Run service and notice that files are
getting loaded from development folder using a debug message.

- Run setup.py and notice that files get installed in
/usr/share/freedombox/modules-enabled/ and in the next run they get loaded from
there.

- Create a override file in /etc/plinth/modules-enabled/transmission and notice
that overriden file gets priority over the one in
/usr/share/freedombox/modules-enabled.

- Link the file /etc/plinth/modules-enabled/transmission to /dev/null and notice
that is not loaded.

- Create another file in /etc/freedombox/modules-enabled/transmission and notice
that it overrides the previous two files.

- All affected modules are loaded.

- Build a new Debian package and ensure that upgrading 23.8 to new version
removes are all configuration files.

- Build developer documentation and test that Tutorial -> Full Code and Tutorial
-> Skeleton sections have been updated with references to
-.../modules-enabled/... paths.

- Install quassel and notice that certificates were copied to /var/lib/quassel
directory. Change domain to another domain and notice that certificates were
copied again to that directory.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2023-05-13 07:08:43 -04:00
1 parent 88d7e1c934
commit 40eecb6446
70 files changed
+153 -50

No files matched your search

+3 -3
View File
@@ -42,10 +42,10 @@ plinth/modules/transmission/views.py
.. literalinclude:: ../../../plinth/modules/transmission/views.py
:language: python3
plinth/modules/transmission/data/etc/plinth/modules-enabled/transmission
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
plinth/modules/transmission/data/usr/share/freedombox/modules-enabled/transmission
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. literalinclude:: ../../../plinth/modules/transmission/data/etc/plinth/modules-enabled/transmission
.. literalinclude:: ../../../plinth/modules/transmission/data/usr/share/freedombox/modules-enabled/transmission
:language: text
plinth/modules/transmission/data/etc/apache2/conf-available/transmission-plinth.conf
+18 -15
View File
@@ -22,13 +22,15 @@ in a step-by-step manner::
├─ urls.py
├─ views.py
├─┬ data/
│ └─┬ etc/
│ ├─┬ plinth/
│ │ └─┬ modules-enabled/
│ │ └─ transmission
│ └─┬ apache2/
│ └─┬ conf-available/
│ └─ transmission-freedombox.conf
│ ├─┬ etc/
│ │ └─┬ apache2/
│ │ └─┬ conf-available/
│ │ └─ transmission-freedombox.conf
│ └─┬ usr/
│ └─┬ share/
│ └─┬ freedombox/
│ └─┬ modules-enabled/
│ └─ transmission
└─┬ tests
└─ __init__.py
@@ -50,19 +52,20 @@ Tell FreedomBox that our app exists
The first thing to do is tell FreedomBox that our app exists. This is done by
writing a small file with the Python import path to our app and placing it in
``plinth/modules/transmission/data/etc/plinth/modules-enabled/``. Let us create
this file ``transmission``:
``plinth/modules/transmission/data/usr/share/freedombox/modules-enabled/``. Let
us create this file ``transmission``:
.. code-block:: text
:caption: ``plinth/modules/transmission/data/etc/plinth/modules-enabled/transmission``
:caption: ``plinth/modules/transmission/data/usr/share/freedombox/modules-enabled/transmission``
plinth.modules.transmission
This file is automatically installed to ``/etc/plinth/modules-enabled/`` by
FreedomBox's installation script ``setup.py``. If we are writing a module that
resides independently outside the FreedomBox's source code, the setup script
will need to copy it to the target location. Further, it is not necessary for
the app to be part of the ``plinth.modules`` namespace. It can, for example, be
This file is automatically installed to
``/usr/share/freedombox/modules-enabled/`` by FreedomBox's installation script
``setup.py``. If we are writing a module that resides independently outside the
FreedomBox's source code, the setup script will need to copy it to the target
location. Further, it is not necessary for the app to be part of the
``plinth.modules`` namespace. It can, for example, be
``freedombox_transmission``.
Creating the App class