From 13db2c2372fab53b0049955813743c7baf6fb41d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 16 May 2023 11:23:40 -0700 Subject: [PATCH] gitweb: Use drop-in config component for /etc files Tests: - Config files are all symlinks /etc/ - Configuration file is effective - Web interface works - Web interface authentication works Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- debian/freedombox.maintscript | 3 +++ plinth/modules/gitweb/__init__.py | 10 +++++++++- .../apache2/conf-available/gitweb-freedombox-auth.conf | 0 .../etc/apache2/conf-available/gitweb-freedombox.conf | 0 .../share/freedombox}/etc/gitweb-freedombox.conf | 0 5 files changed, 12 insertions(+), 1 deletion(-) rename plinth/modules/gitweb/data/{ => usr/share/freedombox}/etc/apache2/conf-available/gitweb-freedombox-auth.conf (100%) rename plinth/modules/gitweb/data/{ => usr/share/freedombox}/etc/apache2/conf-available/gitweb-freedombox.conf (100%) rename plinth/modules/gitweb/data/{ => usr/share/freedombox}/etc/gitweb-freedombox.conf (100%) diff --git a/debian/freedombox.maintscript b/debian/freedombox.maintscript index 5727e68f5..f8edf65bd 100644 --- a/debian/freedombox.maintscript +++ b/debian/freedombox.maintscript @@ -87,3 +87,6 @@ rm_conffile /etc/plinth/modules-enabled/users 23.10~ rm_conffile /etc/plinth/modules-enabled/wireguard 23.10~ rm_conffile /etc/plinth/modules-enabled/wordpress 23.10~ rm_conffile /etc/plinth/modules-enabled/zoph 23.10~ +rm_conffile /etc/gitweb-freedombox.conf 23.10~ +rm_conffile /etc/apache2/conf-available/gitweb-freedombox.conf 23.10~ +rm_conffile /etc/apache2/conf-available/gitweb-freedombox-auth.conf 23.10~ diff --git a/plinth/modules/gitweb/__init__.py b/plinth/modules/gitweb/__init__.py index 1d438fb9e..63cdf13f7 100644 --- a/plinth/modules/gitweb/__init__.py +++ b/plinth/modules/gitweb/__init__.py @@ -7,6 +7,7 @@ from django.utils.translation import gettext_lazy as _ from plinth import app as app_module from plinth import frontpage, menu +from plinth.config import DropinConfigs from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore from plinth.modules.firewall.components import Firewall @@ -35,7 +36,7 @@ class GitwebApp(app_module.App): app_id = 'gitweb' - _version = 2 + _version = 3 def __init__(self): """Create components for the app.""" @@ -68,6 +69,13 @@ class GitwebApp(app_module.App): packages = Packages('packages-gitweb', ['gitweb', 'highlight']) self.add(packages) + dropin_configs = DropinConfigs('dropin-configs-gitweb', [ + '/etc/gitweb-freedombox.conf', + '/etc/apache2/conf-available/gitweb-freedombox.conf', + '/etc/apache2/conf-available/gitweb-freedombox-auth.conf' + ]) + self.add(dropin_configs) + firewall = Firewall('firewall-gitweb', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) diff --git a/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox-auth.conf b/plinth/modules/gitweb/data/usr/share/freedombox/etc/apache2/conf-available/gitweb-freedombox-auth.conf similarity index 100% rename from plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox-auth.conf rename to plinth/modules/gitweb/data/usr/share/freedombox/etc/apache2/conf-available/gitweb-freedombox-auth.conf diff --git a/plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf b/plinth/modules/gitweb/data/usr/share/freedombox/etc/apache2/conf-available/gitweb-freedombox.conf similarity index 100% rename from plinth/modules/gitweb/data/etc/apache2/conf-available/gitweb-freedombox.conf rename to plinth/modules/gitweb/data/usr/share/freedombox/etc/apache2/conf-available/gitweb-freedombox.conf diff --git a/plinth/modules/gitweb/data/etc/gitweb-freedombox.conf b/plinth/modules/gitweb/data/usr/share/freedombox/etc/gitweb-freedombox.conf similarity index 100% rename from plinth/modules/gitweb/data/etc/gitweb-freedombox.conf rename to plinth/modules/gitweb/data/usr/share/freedombox/etc/gitweb-freedombox.conf