From b84749a07dbd418f74b92c7143646be5a5bc4098 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 24 Nov 2026 20:05:35 -0800 Subject: [PATCH] apache: Fix issue with re-running app setup After removing the index page, when setup is re-run, the setup fails. Fix this by ignoring the step of index page does not exist. Tests: - Rerun apache app setup by removing plinth.sqlite3 or incrementing the app version number of the initial setup. Without the patch, the setup fails. With the patch, it succeeds. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- freedombox/modules/apache/privileged.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/freedombox/modules/apache/privileged.py b/freedombox/modules/apache/privileged.py index ba79b3a08..f529d95d7 100644 --- a/freedombox/modules/apache/privileged.py +++ b/freedombox/modules/apache/privileged.py @@ -67,8 +67,11 @@ def _remove_default_index_html(): default_page = pathlib.Path('/var/www/html/index.html') shipped_default_page = pathlib.Path( '/usr/share/apache2/default-site/index.html') - if default_page.read_text() == shipped_default_page.read_text(): - default_page.unlink(missing_ok=True) + try: + if default_page.read_text() == shipped_default_page.read_text(): + default_page.unlink(missing_ok=True) + except FileNotFoundError: + pass @privileged